Hi,
i've been pulling my hair over this problem, i've read all the post about deallocation problem but couldnt understand why, because i'm pretty new with objective-c and iphone, as you can tell :)
but what i dont understand is this block of code below saying i've over-deallocated UIImage, now i have tried everything but the app still crashes
UIImage *imageSave = [UIImage imageNamed:@"btn_save.png"];
UIButton *btnSave = [UIButton buttonWithType:UIButtonTypeCustom];
[btnSave setBackgroundImage:imageSave forState:UIControlStateNormal];
btnSave.frame = CGRectMake(0, 0, imageSave.size.width, imageSave.size.height);
[btnSave addTarget:self action:@selector(save) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *barBtnSave = [[UIBarButtonItem alloc] initWithCustomView:btnSave];
self.navigationItem.rightBarButtonItem = barBtnSave;
//[imageSave release];
//[btnSave release];
[barBtnSave release];
UIImage *imageCancel = [UIImage imageNamed:@"btn_cancel.png"];
UIButton *btnCancel = [UIButton buttonWithType:UIButtonTypeCustom];
[btnCancel setBackgroundImage:imageCancel forState:UIControlStateNormal];
btnCancel.frame = CGRectMake(0, 0, imageCancel.size.width, imageCancel.size.height);
[btnCancel addTarget:self action:@selector(cancel) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *barBtnCancel = [[UIBarButtonItem alloc] initWithCustomView:btnCancel];
self.navigationItem.leftBarButtonItem = barBtnCancel;
//[imageCancel release];
//[btnCancel release];
[barBtnCancel release];