[英]Objective-C syntax error “Expected ']'”
我正在尝试在TableView
配置单元格。 我要尝试做的一件事是更改单元格中文本的字体和颜色。 这是代码:
- (void)configureView {
UIFont *cellFont = [UIFont fontWithName:@"Raleway-Thin" size:14];
NSDictionary *cellAttributesDictionary = [NSForegroundColorAttributeName: [UIColor whiteColor], NSFontAttributeName: cellFont];
}
在NSFontAttributeName
之后的冒号中,我得到错误Expected ']'
。 是什么导致此错误?
在Objective-C中,字典文字的正确语法为@{...};
NSDictionary *cellAttributesDictionary = @{NSForegroundColorAttributeName: [UIColor whiteColor], NSFontAttributeName: cellFont};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.