xcode UITableViewCellAccessoryCheckmark 未在 iOS 7 中显示

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19250867/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 04:03:24  来源:igfitidea点击:

UITableViewCellAccessoryCheckmark not showing in iOS 7

iosobjective-cxcodeuitableview

提问by wvp

I'm having a problem showing the Checkmark accessory in my cell. When I use something another type of accessory it works but not with the Checkmark accessory.

我在单元格中显示 Checkmark 附件时遇到问题。当我使用其他类型的配件时,它可以工作,但不能与 Checkmark 配件一起使用。

It works perfectly in iOS 6 but not on iOS 7. When am I missing?

它在 iOS 6 上完美运行,但在 iOS 7 上却没有。我什么时候失踪了?

 (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:EVENT_SELECTION_CELL_IDENTIFIER forIndexPath:indexPath];
    Event *event = [self.fetchedResultsController objectAtIndexPath:indexPath];
    cell.textLabel.text = event.name;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    if ([event.current boolValue]) {
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
    } else {
        cell.accessoryType = UITableViewCellAccessoryNone;
    }
    return cell;
}

回答by freak AR

I solved this issues changing the tint color of the uitableview

我解决了这个问题,改变了 uitableview 的色调

I changed the tintcolot of uitable by InterfaceBuilder to Default color

我通过 InterfaceBuilder 将 uitable 的 tintcolot 更改为默认颜色

or

或者

TableView.tintColor =  [UIColor blackColor];

回答by jem

In case this might help somebody.... for me, setting the tableview tint color did not work, but setting the cell tint color in cellForRowAtIndexPath did work:

如果这可能对某人有所帮助....对我来说,设置 tableview 色调颜色不起作用,但在 cellForRowAtIndexPath 中设置单元格色调颜色确实有效:

cell.tintColor = [UIColor grayColor];

回答by Aqua

To get the blue checkmark back (similar to iOS6), you can use:

要恢复蓝色复选标记(类似于 iOS6),您可以使用:

cell.tintColor = [UIColor colorWithRed:(0.0/255.0) green:(122.0/255.0) blue:(255.0/255.0) alpha:1.0];

回答by chewy

Just as a reality check since your code seems ok can you change your [event.current boolValue] to YES , it seems the issue is actually in the value... I will also check the delegate of the tableview..

就像现实检查一样,因为您的代码似乎没问题,您可以将 [event.current boolValue] 更改为 YES ,看来问题实际上出在值上...我还将检查 tableview 的委托。

if not this or that, let us know... i will delete this answer...

如果不是这个或那个,让我们知道......我会删除这个答案......

if (YES) {
//..
}