|
@@ -48,6 +48,7 @@ static const int history_delta = 7;
|
|
|
self.emptyBtn.layer.masksToBounds = YES;
|
|
self.emptyBtn.layer.masksToBounds = YES;
|
|
|
self.emptyBtn.hidden = YES;
|
|
self.emptyBtn.hidden = YES;
|
|
|
|
|
|
|
|
|
|
+ [self registNotification];
|
|
|
[self.loadIndicator stopAnimating];
|
|
[self.loadIndicator stopAnimating];
|
|
|
[self configureTableView];
|
|
[self configureTableView];
|
|
|
|
|
|
|
@@ -58,33 +59,7 @@ static const int history_delta = 7;
|
|
|
[super didReceiveMemoryWarning];
|
|
[super didReceiveMemoryWarning];
|
|
|
// Dispose of any resources that can be recreated.
|
|
// Dispose of any resources that can be recreated.
|
|
|
}
|
|
}
|
|
|
-- (void)switchMode:(id)sender {
|
|
|
|
|
-
|
|
|
|
|
- AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
|
|
-
|
|
|
|
|
- appDelegate.personalmode = ! appDelegate.personalmode;
|
|
|
|
|
-
|
|
|
|
|
- NSString* msg = @"";
|
|
|
|
|
- if(appDelegate.personalmode)
|
|
|
|
|
- {
|
|
|
|
|
- msg=@"Personal Mode On.";
|
|
|
|
|
- self.tabBarController.navigationItem.leftBarButtonItem.image = [[UIImage imageNamed:@"apexlogo-2p"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- msg=@"Personal Mode Off.";
|
|
|
|
|
- self.tabBarController.navigationItem.leftBarButtonItem.image = [[UIImage imageNamed:@"apexlogo-2"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- [RAUtils alert_view:msg title:@"Personal Mode"];
|
|
|
|
|
-// [self loadContentWithOption:option Complete:^(int result, int count)
|
|
|
|
|
- [self reloadContent];
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-- (void)reloadContent {
|
|
|
|
|
- [self loadData];
|
|
|
|
|
-}
|
|
|
|
|
|
|
+
|
|
|
- (void)viewWillAppear:(BOOL)animated {
|
|
- (void)viewWillAppear:(BOOL)animated {
|
|
|
[super viewWillAppear:animated];
|
|
[super viewWillAppear:animated];
|
|
|
|
|
|
|
@@ -111,6 +86,10 @@ static const int history_delta = 7;
|
|
|
if (self.navigationController && !self.navigationController.isNavigationBarHidden) {
|
|
if (self.navigationController && !self.navigationController.isNavigationBarHidden) {
|
|
|
|
|
|
|
|
UIImage *logo = [[UIImage imageNamed:@"apexlogo-2"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
|
UIImage *logo = [[UIImage imageNamed:@"apexlogo-2"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
|
|
|
|
+ AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
|
|
|
+ if (appDelegate.personalmode) {
|
|
|
|
|
+ logo = [[UIImage imageNamed:@"apexlogo-2p"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
|
|
|
|
+ }
|
|
|
UIBarButtonItem *logoItem = [[UIBarButtonItem alloc] initWithImage:logo landscapeImagePhone:logo style:UIBarButtonItemStylePlain target:self action:@selector(switchMode:)];
|
|
UIBarButtonItem *logoItem = [[UIBarButtonItem alloc] initWithImage:logo landscapeImagePhone:logo style:UIBarButtonItemStylePlain target:self action:@selector(switchMode:)];
|
|
|
logoItem.enabled = true;
|
|
logoItem.enabled = true;
|
|
|
self.tabBarController.navigationItem.leftBarButtonItem = logoItem;
|
|
self.tabBarController.navigationItem.leftBarButtonItem = logoItem;
|
|
@@ -140,6 +119,22 @@ static const int history_delta = 7;
|
|
|
[self.shipTableView reloadData];
|
|
[self.shipTableView reloadData];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+- (void)registNotification {
|
|
|
|
|
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handlePersonModeChangeNotification:) name:APPersonModeChangeNotification object:nil];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+- (void)handlePersonModeChangeNotification:(NSNotification *)notification {
|
|
|
|
|
+ [self reloadContent];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+- (void)postPersonModeChangeNotification {
|
|
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:APPersonModeChangeNotification object:nil];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+- (void)dealloc {
|
|
|
|
|
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
#pragma mark - Load Data
|
|
#pragma mark - Load Data
|
|
|
|
|
|
|
|
- (NSMutableArray *)shipArray {
|
|
- (NSMutableArray *)shipArray {
|
|
@@ -149,11 +144,18 @@ static const int history_delta = 7;
|
|
|
return _shipArray;
|
|
return _shipArray;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+- (void)reloadContent {
|
|
|
|
|
+ NSLog(@"History Person Mode Change");
|
|
|
|
|
+
|
|
|
|
|
+ [self loadData];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
- (void)loadData {
|
|
- (void)loadData {
|
|
|
|
|
|
|
|
__weak typeof(self) weakSelf = self;
|
|
__weak typeof(self) weakSelf = self;
|
|
|
[self loadContentWithOption:0 Complete:^(int result, int count) {
|
|
[self loadContentWithOption:0 Complete:^(int result, int count) {
|
|
|
[weakSelf.shipTableView reloadData];
|
|
[weakSelf.shipTableView reloadData];
|
|
|
|
|
+ [weakSelf.shipTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];
|
|
|
}];
|
|
}];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -164,6 +166,11 @@ static const int history_delta = 7;
|
|
|
*/
|
|
*/
|
|
|
- (void)loadContentWithOption:(int)option Complete:(void (^)(int result,int count))finish {
|
|
- (void)loadContentWithOption:(int)option Complete:(void (^)(int result,int count))finish {
|
|
|
|
|
|
|
|
|
|
+ // 避免重复刷新
|
|
|
|
|
+ if (self.loadIndicator.isAnimating) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
NSInteger offset = 0;
|
|
NSInteger offset = 0;
|
|
|
|
|
|
|
|
if (option == 2) {
|
|
if (option == 2) {
|
|
@@ -224,9 +231,6 @@ static const int history_delta = 7;
|
|
|
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - Actinon
|
|
#pragma mark - Actinon
|
|
@@ -236,6 +240,28 @@ static const int history_delta = 7;
|
|
|
[self loadData];
|
|
[self loadData];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+- (void)switchMode:(id)sender {
|
|
|
|
|
+
|
|
|
|
|
+ AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
|
|
+
|
|
|
|
|
+ appDelegate.personalmode = ! appDelegate.personalmode;
|
|
|
|
|
+
|
|
|
|
|
+ NSString* msg = @"";
|
|
|
|
|
+ if(appDelegate.personalmode)
|
|
|
|
|
+ {
|
|
|
|
|
+ msg=@"Personal Mode On.";
|
|
|
|
|
+ self.tabBarController.navigationItem.leftBarButtonItem.image = [[UIImage imageNamed:@"apexlogo-2p"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ msg=@"Personal Mode Off.";
|
|
|
|
|
+ self.tabBarController.navigationItem.leftBarButtonItem.image = [[UIImage imageNamed:@"apexlogo-2"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ [self postPersonModeChangeNotification];
|
|
|
|
|
+ [RAUtils alert_view:msg title:@"Personal Mode"];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
#pragma mark - TableView DataSource && Delegate
|
|
#pragma mark - TableView DataSource && Delegate
|
|
|
|
|
|
|
|
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
|
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|