I am new to iPhone Developer.
i want to do navigate to new page with animation but i am unable to navigate to new page,
Here is my code snippet,
UIButton *Planbtn = (UIButton *)[self.view viewWithTag:1];
[Planbtn addTarget:self action:@selector(btnClicked) forControlEvents:UIControlEventTouchUpInside];
..
-(void)btnClicked{
NSLog(@"btnClicked");
PlanPage *yourViewController = [[PlanPage alloc] initWithNibName:@"PlanPage" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:yourViewController animated:TRUE];
[yourViewController release];
}
i am able to see btnClicked
in my Log.
Thanks in Advance !
Write these properties in AppDelegate.h
file
@property (strong, nonatomic) YourFirstViewController *yourFirstController;
@property (nonatomic, retain) UINavigationController *navigationControl;
Write this code in AppDelegate.m
file
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.yourFirstViewController = [[YourFirstViewController alloc] initWithNibName:@"YourFirstViewController" bundle:nil]];
navigationController = [[UINavigationController alloc] initWithRootViewController:self.yourFirstViewController];
[self.window addSubview:[navigationController view]];
[self.window makeKeyAndVisible];
return YES;
}
I think it will be helpful to you.
Being your app view based, you can't push the controller, the simplest thing to do is:
PlanPage *yourViewController = [[PlanPage alloc] initWithNibName:@"PlanPage" bundle:[NSBundle mainBundle]];
[self.view addSubView:yourViewController.view];
[yourViewController release];
If you want to animate it, I'm afraid you have either to implement the animation by yourself, or to add a navigation controller to do the job for you