oop*_*psi 6 appearance uitableview uikit ios
我的didFinishLaunchingWithOptions
函数中有以下代码:
[[[UITableViewCell appearance] textLabel]setFont:[UIFont fontWithName:@"someFont" size:12]];
Run Code Online (Sandbox Code Playgroud)
但由于某些原因,这不会改变我的表格单元格中的文本.
如果在表中委托函数cellForRowAtIndexPath
我添加
cell.textLabel.font = [UIFont fontWithName:@"someFont" size:12];
Run Code Online (Sandbox Code Playgroud)
它确实将字体更改为我想要的字体.
有任何想法吗?
使用外观代理不支持设置a的font
属性UITableViewCell
.
您可以通过查找该类的头文件来确定支持哪些属性UI_APPEARANCE_SELECTOR
.
看看,UITableViewCell.h
你会发现只separatorInset
支持(并且backgroundColor
它的超类支持UIView
):
@property (nonatomic) UIEdgeInsets separatorInset NS_AVAILABLE_IOS(7_0) UI_APPEARANCE_SELECTOR; // allows customization of the separator frame
要支持外观自定义,类必须符合
UIAppearanceContainer
协议,并且必须标记相关的访问器方法UI_APPEARANCE_SELECTOR
.
归档时间: |
|
查看次数: |
2234 次 |
最近记录: |