我有一个Message/RLMObject具有NSString *jabberID属性/行的模型,我想检索unique该行内的每个值.
换句话说,我想jabberID从我的Message模型中检索非重复值.任何人都可以帮忙解决这个问题吗?
我使用coredata的方式是使用returnsDistinctResults设置NSFetchRequest.
这是我的 tableViewCell 代码的实现,我在这里所做的只是从 MainViewController 获取数据并将其分配给两个不同的 UILabel。
问题出在 UILabel *subTitle 中,当我使用 attributeText 分配它以传递所需的行距时,应用程序在滚动 tableView 后崩溃。但如果我简单地用 .text = 分配它,它就可以正常运行,不会崩溃。
@property (strong, nonatomic) IBOutlet UILabel *title;
@property (strong, nonatomic) IBOutlet UILabel *subTitle;
- (void)configureWithPosts:(Data *)data {
self.title.text = data.title;
NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:data.excerpt];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[attributeString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [attributeString length])];
[paragraphStyle setLineSpacing:3];
self.subTitle.textColor = [UIColor colorWithRed:102.0f/255.0f green:102.0f/255.0f blue:102.0f/255.0f alpha:1.0];
self.subTitle.attributedText = attributeString;
}
Run Code Online (Sandbox Code Playgroud)
谁能告诉我我在这里做错了什么?
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSConcreteMutableAttributedString initWithString:: nil …Run Code Online (Sandbox Code Playgroud)