在tableView中select多个单元格,并将选中的单元格显示在另一个tableView单元格中作为标签?

您好我正在创build一个与iOS默认闹钟相关的应用程序。 我在tableView中select一个多个单元格。 如果我点击后退button,选定的单元格将作为另一个视图中的标签显示在tableViewCell中。 我正在使用故事板。 这个怎么做?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *thisCell = [tableView cellForRowAtIndexPath:indexPath]; if (thisCell.accessoryType == UITableViewCellAccessoryNone) { thisCell.accessoryType = UITableViewCellAccessoryCheckmark; [myIndexArray addObject:[NSString stringWithFormat:@"%d",indexPath.row]]; } else { thisCell.accessoryType = UITableViewCellAccessoryNone; for(int i=0; i<myIndexArray.count; i++) { if([[myIndexArray objectAtIndex:i]intValue]== indexPath.row) { [myIndexArray removeObjectAtIndex:i]; break; } } } } 

我想要这样的示例图像

我想要一个像重复视图,并按下返回button所选单元格显示在重复tableViewCell。

我在我的应用程序中也是这样做的。 我能帮你…
RepeatDayViewController

 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; if (UITableViewCellAccessoryNone == cell.accessoryType ) { cell.accessoryType = UITableViewCellAccessoryCheckmark; NSNumber *dayNumber = [NSNumber numberWithInteger:indexPath.row]; [self.repeatDays addObject:dayNumber]; } else { cell.accessoryType = UITableViewCellAccessoryNone; NSNumber *dayNumber = [NSNumber numberWithInteger:indexPath.row]; [self.repeatDays removeObject:dayNumber]; } } 

我正在将self.repeatDays传递给AddAlarmViewController


AddAlarmViewController
我有一个这样的数组

  _days = [[NSArray alloc ]initWithObjects:@"Sun",@"Mon",@"Tue",@"Wed",@"Thu",@"Fri",@"Sat",nil]; - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if ([self.repeatDays count]) { NSMutableArray *repeatDays = [NSMutableArray array]; for (NSNumber *dayNumber in self.repeatDays) { [repeatDays addObject:[_days objectAtIndex:[dayNumber integerValue]]]; } NSString *repeatLabel = [repeatDays componentsJoinedByString:@" "]; cell.detailTextLabel.text = repeatLabel; } else { cell.detailTextLabel.text = NSLocalizedString(@"Never",nil); } } 

用户在哪里select行保存行动的任何洁具,如NSUserDefaults

在里面

 -(void)viewDidAppear:(BOOL)animated{ UITableViewCell* testCell = [azanTableview cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]]; if ([[NSUserDefaults standardUserDefaults]boolForKey:@"testCell"]==YES) { testCell.accessoryType = UITableViewCellAccessoryCheckmark; testCell .textLabel.textColor = [UIColor colorWithRed:0.22 green:0.33 blue:0.53 alpha:1.0]; } } 

等等…