我是繼承UIView並使用它的實例來設置我的UITableViewCell backgroundView和selectedBackedView屬性。我在UIView子類的drawRect方法中收到EXC_BAD_ACCESS錯誤。CGContextRef - EXC_BAD_ACCESS錯誤
if(nil == cell){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
cell.backgroundView = [[CCViewBackground alloc]init];
cell.selectedBackgroundView = [[CCViewBackground alloc]init];
}
UIView子類CCBackgroundView -drawRect:
- (void)drawRect:(CGRect)rect
{
// Drawing code
CGContextRef context = UIGraphicsGetCurrentContext();
CGColorRef redColor =
[UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:1.0].CGColor;
CGContextSetFillColorWithColor(context, redColor); //Receiving EXC_BAD_ACCESS here
CGContextFillRect(context, self.bounds);
}
你能爲你的應用啓用NSZombie並分享接收的原因EXC_BAD_ACCESS –
這是現在NSZombie啓用的錯誤信息 - *** - [Not A Type retain]:發送到釋放實例的消息0x109b50 – Michael