VisitWebsiteVC *visitWebSite = [[[VisitWebsiteVC alloc] initWithNibName:@"VisitWebsiteVC" bundle:nil] retain];
[self.navigationController pushViewController:visitWebSite animated:YES];
[visitWebSite dealloc];
What will happen due to [visitWebSite dealloc].
First of all you should NEVER invoke the dealloc method (except [super dealloc] in dealloc).
You code should throw a BAD_ACCESS exception
(Retain count) Alloc = 1 Retain +1 = 2 Push +1 = 3 Dealloc = 0
But you VisitWebsiteVC instance is still in use by the navigation controller
What you should do is :
VisitWebsiteVC *visitWebSite = [[VisitWebsiteVC alloc] initWithNibName:@"VisitWebsiteVC" bundle:nil];
[self.navigationController pushViewController:visitWebSite animated:YES];
[visitWebSite release];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.