aud*_*nce 6 uitableview ios6 ios7
我现在正在处理一个奇怪的问题.我的应用程序部署目标设置为iOS6,因此我想同时支持iOS6和iOS7.
我只有一个简单的UITableView,用户可以在其中选择首选的通知声音.
代码- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath是:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CheckmarkCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
[cell setTintColor:[UIColor redColor]];
if (indexPath.section == 0){
cell.textLabel.text = [_availableSounds objectAtIndex:indexPath.row];
if (indexPath.row == _checkedSoundIndexPath.row) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
}
else {
// Unrelated, another settings cell
cell.accessoryType = UITableViewCellAccessoryNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
return cell;
}
Run Code Online (Sandbox Code Playgroud)
我- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath看起来如下:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section != 0) {
return;
}
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
[[self.tableView cellForRowAtIndexPath:indexPath] setAccessoryType:UITableViewCellAccessoryCheckmark];
if (_checkedSoundIndexPath != indexPath) {
[[self.tableView cellForRowAtIndexPath:_checkedSoundIndexPath] setAccessoryType:UITableViewCellAccessoryNone];
}
_checkedSoundIndexPath = indexPath;
}
Run Code Online (Sandbox Code Playgroud)
问题是iOS7 iPhone不会按预期显示复选标记.在iOS6 iPhone上运行相同的代码按预期工作.我试图插入[cell setTintColor:[UIColor redColor]];但没有任何运气.即使我删除了所有与AccessoryType相关的代码并在我的故事板中添加了复选标记,也不会出现任何内容.请参阅下面的屏幕截图(首先是iOS6,第二个是iOS5).
有没有人有想法?或者它是iOS7中的错误?
提前致谢 !
编辑:
即使我创建一个新的简单的UITableViewController,只有5个单元,Accessory设置为UITableViewAccessoryTypeCheckmark,Checkmarks将不会出现在iOS7上.

fre*_* AR 10
我有类似的问题,我解决了这个问题,改变了uitableview的色调
我通过InterfaceBuilder将uint的tintcolot更改为Default color
要么
tableView.tintColor = [UIColor blackColor];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4363 次 |
| 最近记录: |