|
@@ -429,10 +429,39 @@ static const int delta = 25;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (void)setupNavigationBar {
|
|
- (void)setupNavigationBar {
|
|
|
- UIBarButtonItem *downloadItem = [[UIBarButtonItem alloc] initWithTitle:@"Download" style:UIBarButtonItemStylePlain target:self action:@selector(downloadItemClick:)];
|
|
|
|
|
- self.navigationItem.rightBarButtonItem = downloadItem;
|
|
|
|
|
|
|
+ UIBarButtonItem *menuItem = [[UIBarButtonItem alloc] initWithTitle:@"Menu" style:UIBarButtonItemStylePlain target:self action:@selector(MenuClick:)];
|
|
|
|
|
+ self.navigationItem.rightBarButtonItem = menuItem;
|
|
|
|
|
+}
|
|
|
|
|
+- (void)MenuClick:(UIBarButtonItem *)sender {
|
|
|
|
|
+
|
|
|
|
|
+ UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Menu" message:nil preferredStyle:UIAlertControllerStyleAlert];
|
|
|
|
|
+ //block代码块取代了delegate
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ for(int i=0;i<self.content_menu.count;i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ NSMutableDictionary* json = self.content_menu[i];
|
|
|
|
|
+ NSString* title =json[@"title"];
|
|
|
|
|
+ NSString* actiontype = json[@"action"];
|
|
|
|
|
+ NSMutableDictionary* add_params = json[@"params"];
|
|
|
|
|
+ UIAlertAction *actioni = [UIAlertAction actionWithTitle:title style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
|
|
|
|
|
+ // DebugLog(@"Cancel");
|
|
|
|
|
+ if([actiontype isEqualToString:@"download"])
|
|
|
|
|
+ {
|
|
|
|
|
+ }
|
|
|
|
|
+ else if([actiontype isEqualToString:@"save"])
|
|
|
|
|
+ {
|
|
|
|
|
+ }
|
|
|
|
|
+ }];
|
|
|
|
|
+ [alertControl addAction:actioni];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ [self presentViewController:alertControl animated:YES completion:nil];
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- (void)downloadItemClick:(UIBarButtonItem *)sender {
|
|
- (void)downloadItemClick:(UIBarButtonItem *)sender {
|
|
|
|
|
|
|
|
|
|
|
|
@@ -501,7 +530,8 @@ static const int delta = 25;
|
|
|
__strong typeof(weakSelf) strongSelf = weakSelf;
|
|
__strong typeof(weakSelf) strongSelf = weakSelf;
|
|
|
if (result == RESULT_TRUE) {
|
|
if (result == RESULT_TRUE) {
|
|
|
strongSelf.content_layout = [contentDic objectForKey:@"layout"];
|
|
strongSelf.content_layout = [contentDic objectForKey:@"layout"];
|
|
|
- strongSelf.content_action = [contentDic objectForKey:@"action"];
|
|
|
|
|
|
|
+ strongSelf.content_action = [contentDic objectForKey:@"row_action"];
|
|
|
|
|
+ strongSelf.content_menu = [[contentDic objectForKey:@"menu"] mutableCopy];
|
|
|
strongSelf.content_data = [contentDic objectForKey:@"data"];
|
|
strongSelf.content_data = [contentDic objectForKey:@"data"];
|
|
|
[strongSelf updateTableFrame];
|
|
[strongSelf updateTableFrame];
|
|
|
[strongSelf.tableview reloadData];
|
|
[strongSelf.tableview reloadData];
|