objective-c - 选中时将单元格标题设置为粗体

标签 objective-c ios cocoa-touch

我在一个更复杂的模态对话框中内置了一个 TableView 。在显示对话框之前,我在外部提供所选单元格的索引,并在 tv:willDisplayCell: 中提供对话框进程,以便正确的单元格具有粗体。但是当对话框最终弹出时,我需要允许它也随着我选择其他行而改变。
我可能遗漏了一些东西,但我该怎么做呢?如何将选定的单元格标题字体设置为粗体?

最佳答案

您可以在适当的委托(delegate)方法中更改字体:

- (void)tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)ip
{
    UITableViewCell *c = [tv cellForRowAtIndexPath:ip];
    c.textLabel.font = [UIFont boldSystemFontOfSize:14.0]; // for example
}

关于objective-c - 选中时将单元格标题设置为粗体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13791929/

相关文章:

iphone - 使用缩进级别在 ios 中的 UITableview 中下拉

iphone - 如何完全禁用 UITextView 的滚动?

iphone - UITableViewController didSelectRowAtIndexPath :(NSIndexPath *)indexPath

iphone - 如何从 iPhone 通讯录中检索手机号码。

objective-c - 自动引用计数是否会在运行时产生成本

iphone - ZBAR sdk 未在 iPhone 4s (ios 5.1) 上检测到 QRCODES...?

ios - 命令行 C 程序到 Swift

ios - CALayer 未实现自定义 drawLayer :inContext: method

ios - 序列化包含未实现 NSCoding 的类的 NSMutableArray

iphone - UISearchBar 与 iMac Finder 搜索功能相同