|
@@ -83,8 +83,9 @@ static NSString *kLastMode = @"lastChooseMode";
|
|
|
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
|
if (appDelegate.shouldAutoShowModeVC) {
|
|
if (appDelegate.shouldAutoShowModeVC) {
|
|
|
if (self.lastChoosedIndex > -1) {
|
|
if (self.lastChoosedIndex > -1) {
|
|
|
- RootModeCell *cell = [self.modeTable cellForRowAtIndexPath:[NSIndexPath indexPathForRow:self.lastChoosedIndex inSection:0]];
|
|
|
|
|
- [self pushCurrentModeController:cell];
|
|
|
|
|
|
|
+// RootModeCell *cell = [self.modeTable cellForRowAtIndexPath:[NSIndexPath indexPathForRow:self.lastChoosedIndex inSection:0]];
|
|
|
|
|
+// [self pushCurrentModeController:cell];
|
|
|
|
|
+ [self tableView:self.modeTable didSelectRowAtIndexPath:[NSIndexPath indexPathForRow:self.lastChoosedIndex inSection:0]];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
appDelegate.shouldAutoShowModeVC = NO;
|
|
appDelegate.shouldAutoShowModeVC = NO;
|
|
@@ -111,6 +112,8 @@ static NSString *kLastMode = @"lastChooseMode";
|
|
|
self.lastChoosedIndex = indexPath.row;
|
|
self.lastChoosedIndex = indexPath.row;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ BOOL enable = [[mode objectForKey:@"enable"] boolValue];
|
|
|
|
|
+ cell.enable = enable;
|
|
|
|
|
|
|
|
return cell;
|
|
return cell;
|
|
|
}
|
|
}
|
|
@@ -119,9 +122,13 @@ static NSString *kLastMode = @"lastChooseMode";
|
|
|
|
|
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
RootModeCell *cell = [tableView cellForRowAtIndexPath:indexPath];
|
|
RootModeCell *cell = [tableView cellForRowAtIndexPath:indexPath];
|
|
|
- NSString *mode = cell.mode;
|
|
|
|
|
- [self setUserDefaultsValue:mode forKey:kLastMode];
|
|
|
|
|
- [self pushCurrentModeController:cell];
|
|
|
|
|
|
|
+ NSDictionary *mode = [self.modeList objectAtIndex:indexPath.row];
|
|
|
|
|
+ BOOL enable = [[mode objectForKey:@"enable"] boolValue];
|
|
|
|
|
+ if (enable) {
|
|
|
|
|
+ NSString *name = cell.mode;
|
|
|
|
|
+ [self setUserDefaultsValue:name forKey:kLastMode];
|
|
|
|
|
+ [self pushCurrentModeController:cell];
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - Private
|
|
#pragma mark - Private
|