I am working on an app which has been created in Xcode 3.2.5. My app is working as expected in XCode 3.2.5 but because of some memory issues now I am using Xcode 4.2.
Xcode 4.2 offers a tool to convert existing code into ARC [which stands for Automatic Reference Counting.] enabled code . Select Edit -> Refactor… -> Convert to Objective-C ARC…worked for me.
In my code I am using navigationController to switch between views on UIbutton click.
UIButton created programmatically. I am using following code to push view controller on button_click:
-(void) button_click:(id)sender{
NSLog(@"button_clicked.....");
SecondView *sv = [[SecondView alloc] initWithNibName:@"SecondView" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:sv animated:NO];
}
On button_click console showing message button_clicked….. but pushViewcontroller not pushing SecondView.
pushViewController is working in XCode 3.2.5 but in XCode 4.2 button click is working but navigationController’s pushviewController is not working.
how can i fix it?
Any help would be greatly appreciated.
Thank you in advance!
Did you try putting the RootViewController into a navigation controller on the MainWindow.xib?
Addition to my answer:
or
Handling NavigationControllers is explained in detail here