table view 修改背景 NSCFString 异常

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对象,所以才出错