开发者

pushViewController and Release

开发者 https://www.devze.com 2023-01-17 04:11 出处:网络
I am trying to do like this, with the commented lines it works good, without, when I came back from the \"pushed\" view my App just crashes... when should I [release]? Or, better, I am doing this corr

I am trying to do like this, with the commented lines it works good, without, when I came back from the "pushed" view my App just crashes... when should I [release]? Or, better, I am doing this correctly?

if (indexPath.row == 1) {
        Credits *cr = [[Credits alloc] initWithNibName:@"Credits" bundle:nil];
       开发者_JS百科 [self.navigationController pushViewController:cr animated:YES];
        //[cr release];
    }else{
        Search *sr = [[Search alloc] initWithNibName:@"Search" bundle:nil];
        [self.navigationController pushViewController:sr animated:YES];
        //[sr release];
    }


You should release your controller after pushing it onto the navigation view controller's stack of controllers. My guess is that something else is going on in the dealloc of your Search and Credits objects, that you are overreleasing an object there.

0

精彩评论

暂无评论...
验证码 换一张
取 消