Kaynağa Gözat

聊天列表助教不可删除

桂欢 1 yıl önce
ebeveyn
işleme
5b13a84ebb

+ 2 - 0
SLAiELTS/SLAiELTS/ViewControllers/Home/Models/SLChatListModel.h

@@ -37,6 +37,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, assign) BOOL messageType;
 
+@property (nonatomic, assign) BOOL isTeacher;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 2 - 1
SLAiELTS/SLAiELTS/ViewControllers/Home/Views/SLHomeView.m

@@ -65,7 +65,8 @@
 }
 
 - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
-    return YES;
+    SLChatListModel *chatModel = [self.viewModels objectAtIndex:indexPath.row];
+    return !chatModel.isTeacher;
 }
 
 - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {