|
|
@@ -7,8 +7,9 @@
|
|
|
//
|
|
|
|
|
|
#import "DetailTabBarController.h"
|
|
|
+#import "AMResultViewController.h"
|
|
|
|
|
|
-@interface DetailTabBarController ()
|
|
|
+@interface DetailTabBarController () <UITabBarControllerDelegate>
|
|
|
|
|
|
@end
|
|
|
|
|
|
@@ -230,33 +231,133 @@
|
|
|
// self.navigationItem.backBarButtonItem = backButton;
|
|
|
|
|
|
|
|
|
+// UIButton *saveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
+// saveBtn.frame = CGRectMake(0, 0, 30, 30);
|
|
|
+// [saveBtn setImage:[UIImage imageNamed:@"ic_save"] forState:UIControlStateNormal];
|
|
|
+//// [saveBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, -15)]; // 右移
|
|
|
+// [saveBtn addTarget:self action:@selector(saveDetail:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+// UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithCustomView:saveBtn];
|
|
|
+//
|
|
|
+// UIBarButtonItem *fixBtn = [[UIBarButtonItem alloc] initWithTitle:nil style:UIBarButtonItemStylePlain target:nil action:nil];
|
|
|
+// fixBtn.width = 0;
|
|
|
+//
|
|
|
+// UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
+// closeBtn.frame = CGRectMake(0, 0, 30, 30);
|
|
|
+// [closeBtn setImage:[UIImage imageNamed:@"ic_exit"] forState:UIControlStateNormal];
|
|
|
+//// [closeBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, -15)]; // 右移,调整和屏幕大间距
|
|
|
+// [closeBtn addTarget:self action:@selector(closeClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+// UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithCustomView:closeBtn];
|
|
|
+//
|
|
|
+//
|
|
|
+// self.navigationItem.rightBarButtonItems = @[closeButton,fixBtn,saveButton];
|
|
|
+
|
|
|
+
|
|
|
+ self.delegate = self;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)didReceiveMemoryWarning
|
|
|
+{
|
|
|
+ [super didReceiveMemoryWarning];
|
|
|
+ // Dispose of any resources that can be recreated.
|
|
|
+}
|
|
|
+
|
|
|
+- (void)viewWillAppear:(BOOL)animated {
|
|
|
+ [super viewWillAppear:animated];
|
|
|
+
|
|
|
+ [self configureNavigationBar];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
|
|
|
+
|
|
|
+ [self configureNavigationBar];
|
|
|
+}
|
|
|
+
|
|
|
+- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
|
|
|
+
|
|
|
+ return YES;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)configureNavigationBar {
|
|
|
+
|
|
|
UIButton *saveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
saveBtn.frame = CGRectMake(0, 0, 30, 30);
|
|
|
[saveBtn setImage:[UIImage imageNamed:@"ic_save"] forState:UIControlStateNormal];
|
|
|
-// [saveBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, -15)]; // 右移
|
|
|
+ // [saveBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, -15)]; // 右移
|
|
|
[saveBtn addTarget:self action:@selector(saveDetail:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithCustomView:saveBtn];
|
|
|
-
|
|
|
+
|
|
|
UIBarButtonItem *fixBtn = [[UIBarButtonItem alloc] initWithTitle:nil style:UIBarButtonItemStylePlain target:nil action:nil];
|
|
|
fixBtn.width = 0;
|
|
|
|
|
|
UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
closeBtn.frame = CGRectMake(0, 0, 30, 30);
|
|
|
[closeBtn setImage:[UIImage imageNamed:@"ic_exit"] forState:UIControlStateNormal];
|
|
|
-// [closeBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, -15)]; // 右移,调整和屏幕大间距
|
|
|
+ // [closeBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, -15)]; // 右移,调整和屏幕大间距
|
|
|
[closeBtn addTarget:self action:@selector(closeClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithCustomView:closeBtn];
|
|
|
-
|
|
|
|
|
|
- self.navigationItem.rightBarButtonItems = @[closeButton,fixBtn,saveButton];
|
|
|
-
|
|
|
+ UIButton *menuBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
+ menuBtn.frame = CGRectMake(0, 0, 30, 30);
|
|
|
+ [menuBtn setImage:[UIImage imageNamed:@"ic_menu"] forState:UIControlStateNormal];
|
|
|
+ [menuBtn addTarget:self action:@selector(menuClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:menuBtn];
|
|
|
+
|
|
|
+ DetailPageViewController *pageVC = (DetailPageViewController *)self.selectedViewController;
|
|
|
+
|
|
|
+ if([pageVC.function_name isEqualToString:@"Cargo Tracking"] || [pageVC.title isEqualToString:@"Tracing"]) {
|
|
|
+ self.navigationItem.rightBarButtonItems = @[closeButton,fixBtn,menuButton];
|
|
|
+ } else {
|
|
|
+ self.navigationItem.rightBarButtonItems = @[closeButton,fixBtn,saveButton];
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
+- (void)searchDocument {
|
|
|
+
|
|
|
+ DetailPageViewController *pageVC = (DetailPageViewController *)self.selectedViewController;
|
|
|
+ NSString *hbol = [pageVC.content.originContent objectForKey:@"hbol"];
|
|
|
+
|
|
|
+ if (hbol.length) {
|
|
|
+
|
|
|
+ AMResultViewController *resultVC = [[AMResultViewController alloc] initWithNibName:@"Result" bundle:nil];
|
|
|
+ resultVC.params = [@{
|
|
|
+ @"bol" : hbol,
|
|
|
+ @"module_name" : @"Download Document"
|
|
|
+ } mutableCopy];
|
|
|
+ [self.navigationController pushViewController:resultVC animated:YES];
|
|
|
+ } else {
|
|
|
+
|
|
|
+ UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"There is no hbol to search" preferredStyle:UIAlertControllerStyleAlert];
|
|
|
+ UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"ok", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+
|
|
|
+ }];
|
|
|
+ [alertVC addAction:cancelAction];
|
|
|
+
|
|
|
+ [self presentViewController:alertVC animated:YES completion:nil];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-- (void)didReceiveMemoryWarning
|
|
|
-{
|
|
|
- [super didReceiveMemoryWarning];
|
|
|
- // Dispose of any resources that can be recreated.
|
|
|
+- (void)menuClick:(id)sender {
|
|
|
+
|
|
|
+ UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleAlert];
|
|
|
+
|
|
|
+ __weak typeof(self) weakSelf = self;
|
|
|
+ UIAlertAction *saveAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"save", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+ [weakSelf saveDetail:nil];
|
|
|
+ }];
|
|
|
+
|
|
|
+ UIAlertAction *searchAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"search", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+ [weakSelf searchDocument];
|
|
|
+ }];
|
|
|
+ UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"cancel", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ [alertVC addAction:saveAction];
|
|
|
+ [alertVC addAction:searchAction];
|
|
|
+ [alertVC addAction:cancelAction];
|
|
|
+
|
|
|
+ [self presentViewController:alertVC animated:YES completion:nil];
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@end
|