I have two scenario for the project with ARC and project without ARC.
1) The project without ARC.we can use the following.
MyViewController* viewController = [[MyViewController alloc] init];
[self.navigationController pushViewController:viewController animated:YES];
[viewController release];
2)How can I achieve the above in the project which is with ARC.
a)where can I allocate memory?
b)where can I release viewcontroller after pushing?
c)is there any standard for it?
When using ARC you do not need to release the viewController, the compiler will add the
releaseandretainfor you..So in ARC this will do:
Using
retain,releaseandautoreleasewill result in a compiler error.Be aware that you will need to use the
@propertycorrectly when using ARC. Usestrongfor properties that you want to retain andweakfor properties that you just want toassign. If you want iOS 4.3 support you can’t useweakbut should useunsafe_unretained.