导航到新的页面在iPhone按钮点击 [英] navigate to new page on button click in iPhone
本文介绍了导航到新的页面在iPhone按钮点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新来的iPhone开发者。
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,
下面是我的code片段,
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];
}
我能够看到 btnClicked
在我的日志。
在此先感谢!
推荐答案
将在 AppDelegate.h
这些属性文件
@property (strong, nonatomic) YourFirstViewController *yourFirstController;
@property (nonatomic, retain) UINavigationController *navigationControl;
写 AppDelegate.m
这code文件
- (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.
这篇关于导航到新的页面在iPhone按钮点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文