读书人

table view 修改背景 NSCFString 异

发布时间: 2012-09-27 11:11:17 作者: rapoo

table view 修改背景 NSCFString 错误

?table view 修改背景

?

UIImageView *background = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"background.jpg"]];
??? [[self tableView] setBackgroundView:background];
??? [background autorelease];

?

?

?

?

今天还出了一个错误? 本来是array的对象 突然debug的时候发现变成NSCFString了, 网上查了下,说是内存方面的错误,

后来发现

?

@property (nonatomic, retain) NSArray *array;

?

在代码中 array = [_context executeFetchRequest:fetchRequest error:&error];

?

和 self.array = [_context executeFetchRequest:fetchRequest error:&error];

效果是不一样的, 前者没有保存(retain)array对象,所以才出错

读书人网 >移动开发

热点推荐