UIViewController *loginPage = [[[LoginPageViewController alloc] initWithNibName:@"LoginPageViewController" bundle:nil]autorelease];
[[self navigationController] pushViewController:loginPage animated:YES];
有了这部分代码,我想导航到另一个页面。我的按钮单击工作正常,并在级别显示文本。
有一个名为landingpageviewcontroller的类是另一个类LoginPageViewController。我想在landingpageviewcontroller的按钮点击操作上推送LoginPageViewController。你会发布一个示例代码吗?
[self presentViewController:loginPage animated:YES completion:nil];
换来的
[[self navigationController] pushViewController:loginPage animated:YES];
将工作。
尝试如下:
TabsViewController *hello=[[TabsViewController alloc]initWithNibName:@"TabsViewController" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:hello animated:YES];
[hello release];
根据你改变它并检查。
LoginPageViewController *loginPage = [[[LoginPageViewController alloc] initWithNibName@"LoginPageViewController" bundle:nil]autorelease];
[self navigationController pushViewController:loginPage animated:YES];
[loginPage release];
请尝试以下代码
LandingPageViewController.m类
#import"LoginPageViewController.h" //must import .h file
@implementation LandingPageViewController
-(IBAction)onLoginClick:(id)sender
{
LoginPageViewController *loginController = [[[LoginPageViewController alloc] initWithNibName:@"LoginPageViewController" bundle:nil]autorelease];
[self.navigationController pushViewController:loginController animated:YES];
}
@end
试试这个
LoginPageViewController *loginPage = [[[LoginPageViewController alloc] initWithNibName:@"LoginPageViewController" bundle:[NSBundle mainBundle]]autorelease];
[[self navigationController] pushViewController:loginPage animated:YES];
LoginPageViewController *move = [[LoginPageViewController alloc] initWithNibName@"LoginPageViewController" bundle:nil];
[self.navigationController pushViewController:move animated:YES];
[move release];
试试这个对你很有帮助。
[self.navigationController popToViewController:[[self.navigationController viewControllers] objectAtIndex:0] animated:YES];
你可以尝试这个。查看控制器存储到堆栈。你可以直接给你的viewcontroller值。
就像第一个ViewController一样,然后放置0.如果第二个ViewController去,那么放置1.如果第三个ViewController去,那么放置2。