【发布时间】:2011-07-14 17:30:40
【问题描述】:
我正在合成几个字符串:
.h
@property(nonatomic,copy) NSString* bio;
.m
@synthesize bio;
//connectionDidFinish method
bio = [[[profile objectForKey:@"user"] valueForKey:@"profile"] valueForKey:@"bio"];
当我的 tableview 首次加载时,我在 cellForRowAtIndexPath 中收到错误 -[NSNull length]: unrecognized selector sent to instance 0x11d45e8:
case kBioSectionDescriptionRow:
if ([bio length]==0 ||bio == nil) {
cell.textLabel.text = @"bio";
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.detailTextLabel.numberOfLines = 5;
cell.detailTextLabel.font = [UIFont fontWithName:@"Helvetica Neue" size:(14.0)];
cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap;
cell.detailTextLabel.text = @"None";
}
else{
cell.textLabel.text = @"bio";
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.detailTextLabel.numberOfLines = 5;
cell.detailTextLabel.font = [UIFont fontWithName:@"Helvetica Neue" size:(14.0)];
cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap;
cell.detailTextLabel.text = [NSString stringWithFormat: @"%@", bio];
}
break;
如何确保我的简历已分配且不为空?
【问题讨论】:
标签: iphone objective-c cocoa-touch uitableview nsstring