小编aud*_*nce的帖子

Checkmark不会在iOS7上的TableViewCell中显示

我现在正在处理一个奇怪的问题.我的应用程序部署目标设置为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 …
Run Code Online (Sandbox Code Playgroud)

uitableview ios6 ios7

6
推荐指数
2
解决办法
4363
查看次数

标签 统计

ios6 ×1

ios7 ×1

uitableview ×1