Steven 6 місяців тому
батько
коміт
c8a1135bcf

+ 2 - 0
KulexiuForStudent/KulexiuForStudent/Module/Login/Controller/InstrumentChooseViewController.h

@@ -14,6 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface InstrumentChooseViewController : KSBaseViewController
 
+@property (nonatomic, strong) NSString *preSubjectId;
+
 @property (nonatomic, assign) BOOL isModalPresent;
 
 - (void)chooseCallback:(ChooseInstrumentCallback)callback;

+ 8 - 0
KulexiuForStudent/KulexiuForStudent/Module/Login/Controller/InstrumentChooseViewController.m

@@ -134,6 +134,9 @@
                     NSMutableArray *subjectModelArray = [NSMutableArray array];
                     for (NSDictionary *dic in subjects) {
                         InstrumentMessageModel *model = [[InstrumentMessageModel alloc] initWithDictionary:dic];
+                        if ([model.internalBaseClassIdentifier isEqualToString:self.preSubjectId]) {
+                            model.isChoose = YES;
+                        }
                         [subjectModelArray addObject:model];
                     }
                     [instrumentArray addObject:subjectModelArray];
@@ -181,6 +184,11 @@
 
 - (void)countMessageWithModel:(InstrumentMessageModel *)model indexPath:(NSIndexPath *)indexPath {
     if (model.isChoose) {
+        // 取消上一个选中
+        if (self.chooseModel) {
+            self.chooseModel.isChoose = NO;
+            [self.collectionView reloadItemsAtIndexPaths:@[indexPath,self.chooseIndexPath]];
+        }
         self.chooseModel = model;
         self.chooseIndexPath = indexPath;
     }