在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]; } }
等等…
- 应用程序启动后,由于正在input受监视的区域而使用Flurrylogging事件
- 将视图添加到滚动视图,该视图将展开以填充可用的宽度
- Google Maps for iOS – 如何判断一个标记是否在屏幕的边界内?
- 如何在Xcode 6的devise时做自定义字体?
- 应用程序在dealloc崩溃
- 检测数组中的string对象是否与任何命令相匹配
- 如何在iOS SceneKit中将.dae文件加载到SCNNode中?
- 使用Swift Generics识别子类可以使用自定义类,但不能使用UITapGestureRecognizer
- Instagram iPhone Hooks iOS 11.2.5 instagram 29,请勿打开文件,但相机滚动