开发者

pushViewController and Release

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜