Răsfoiți Sursa

1.Root设置模式的Enable属性。

Pen Li 9 ani în urmă
părinte
comite
b71c12380c

BIN
RA Image/RA Image.xcodeproj/project.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 1
RA Image/RA Image/ModelModeViewController.m

@@ -37,7 +37,7 @@
     self.noteTextView.layer.borderWidth = 1.0f;    
     [self registListenKeyboard];
     
-    self.manufacturerList = @[@"New Pacific Direct,inc",@"HMLG",@"Red Ant",@"Facebook"]; // Test Value
+//    self.manufacturerList = @[@"New Pacific Direct,inc",@"HMLG",@"Red Ant",@"Facebook"]; // Test Value
 }
 
 

+ 1 - 0
RA Image/RA Image/RootModeCell.h

@@ -12,5 +12,6 @@
 
 @property (nonatomic,copy) NSString *mode;
 @property (nonatomic,copy) NSString *code_name;
+@property (nonatomic,assign) BOOL enable;
 
 @end

+ 5 - 0
RA Image/RA Image/RootModeCell.m

@@ -31,4 +31,9 @@
     self.modeLabel.text = mode;
 }
 
+- (void)setEnable:(BOOL)enable {
+    _enable = enable;
+    self.modeLabel.enabled = enable;
+}
+
 @end

+ 12 - 5
RA Image/RA Image/RootViewController.m

@@ -83,8 +83,9 @@ static NSString *kLastMode = @"lastChooseMode";
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     if (appDelegate.shouldAutoShowModeVC) {
         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;
@@ -111,6 +112,8 @@ static NSString *kLastMode = @"lastChooseMode";
             self.lastChoosedIndex = indexPath.row;
         }
     }
+    BOOL enable = [[mode objectForKey:@"enable"] boolValue];
+    cell.enable = enable;
     
     return cell;
 }
@@ -119,9 +122,13 @@ static NSString *kLastMode = @"lastChooseMode";
 
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)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