如何在uitableviewcell上显示UIImage
我有UITableview
显示基于UISwitch
状态的UIImage
。 我将开关状态存储在NSMutableArray
。 我能够只显示两个图像,如果我试图显示超过两个不显示。 如果我closures两个较早的UISwitch
状态中的任何一个。 新的开关状态(我试图显示在前面)将显示,也只有一个。
我假设在你的tableview中,每个单元格表示数组中的一个模型的实例。 切换开关时更新模型会不会更好?
... MyObject theObject= [myObjects objectAtIndex:index]; theObject.switchState = TRUE; [self.tableView reloadData]; ...
然后重新加载tableview单元格
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"cellidentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; MyObject *thisObject = [myObjects objectAtIndex:indexPath.row]; if(thisObject.switchState) { ... configure cell accordingly } return cell; }
- 如果NSAllowsArbitraryLoads设置为YES,App Store是否拒绝提交?
- iOS Swift – 将.wav文件合并并转换为.mp3
- 带有ARC的Xcode 4.2:即使在固件版本低于5.0的iOS设备上,我的代码也能运行吗?
- 什么是void *以及它可以指向哪些variables/对象
- 如何从iOS应用程序iOS 11testing版打开位置服务?
- 有没有办法在Xcode 4中编译ARM而不是Thumb?
- 模型视图控制器(MVC)
- pickerview上的随机崩溃didSelect:__ cffrloloop_is_calling_out_to_a_source1_perform1_function
- 在移动应用中embedded调查