I am developing application like Instagram.
I have code for cellForRowAtIndexPath
, every time it creates object for unbutton and it is autorelease. this button display username and it may be 1,2,3,4,5,.. total like users. there for i create UIButton
on depend on like cout.
I am not using ARC
.
but it crash sometimes (Not everyTime) when setColour.
I enabled NSZombie
and it keeps saying:
[UIDeviceRGBColor set]: message sent to deallocated instance 0x21b526f0
UIButton *btnLikeUserName = [[[UIButton alloc] init] autorelease];
[btnLikeUserName.titleLabel setFont:[UIFont boldSystemFontOfSize:12]];
if (posx + size.width > 280) {
posy = posy + 22;
posx = 18;
btnLikeUserName.frame = CGRectMake(posx,posy,size.width,size.height);
posx = posx + size.width + 5;
}
else {
btnLikeUserName.frame = CGRectMake(posx,posy,size.width,size.height);
posx = posx + size.width + 5;
}
btnLikeUserName.tag = shareObjU.userId;
[btnLikeUserName setTitle:text forState:UIControlStateNormal];
[btnLikeUserName setTitleColor:[UIColor colorWithRed:50/255.0 green:79/255.0 blue:133/255.0 alpha:1.0] forState:UIControlStateNormal]; ////Hear is crash
[btnLikeUserName addTarget:self action:@selector(btnLikeUserNameClick:) forControlEvents:UIControlEventTouchUpInside];
[cell.viewLikeComment addSubview:btnLikeUserName];
i also see following link
UISwitch setThumbTintColor causing crash (iOS 6 only)?
1 out of 4 colors return errors
iOS App crashes when using colorWithRed:green:blue:alpha
and other .. but all says for global Objct. not local object. how can i solved it. Thank You