0
UIViewController *loginPage = [[[LoginPageViewController alloc] initWithNibName:@"LoginPageViewController" bundle:nil]autorelease];
[[self navigationController] pushViewController:loginPage animated:YES];

使用这部分代码,我想导航到另一个页面。我的按钮单击工作正常,并在级别显示文本。

有一个类名为landingpageviewcontroller 另一个类LoginPageViewController。我想将 LoginPageViewController 推送到来自landingpageviewcontroller 的按钮单击操作上。你会发布一个示例代码吗?

4

7 回答 7

0
[self presentViewController:loginPage animated:YES completion:nil];

换来的

[[self navigationController] pushViewController:loginPage animated:YES];

将工作。

于 2013-05-30T12:23:21.880 回答
0
LoginPageViewController  *move = [[LoginPageViewController alloc] initWithNibName@"LoginPageViewController" bundle:nil];
[self.navigationController pushViewController:move animated:YES];
[move release];
于 2013-05-30T11:56:58.653 回答
0

试试下面的代码

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
于 2013-05-30T11:11:29.167 回答
0

尝试这个

  LoginPageViewController *loginPage = [[[LoginPageViewController alloc] initWithNibName:@"LoginPageViewController" bundle:[NSBundle mainBundle]]autorelease];
  [[self navigationController] pushViewController:loginPage animated:YES];
于 2013-05-30T11:48:26.580 回答
0

尝试如下:

TabsViewController *hello=[[TabsViewController alloc]initWithNibName:@"TabsViewController" bundle:[NSBundle mainBundle]];
 [self.navigationController pushViewController:hello animated:YES];
    [hello release];

根据您更改并检查。

于 2013-05-30T10:38:27.603 回答
0
LoginPageViewController  *loginPage = [[[LoginPageViewController alloc] initWithNibName@"LoginPageViewController" bundle:nil]autorelease];
[self navigationController pushViewController:loginPage animated:YES];
[loginPage release];
于 2013-05-30T10:39:10.117 回答
0

试试这个对你很有帮助的。

 [self.navigationController popToViewController:[[self.navigationController viewControllers] objectAtIndex:0] animated:YES];

你可以试试这个。View Controller Store into stack 。你可以直接给你的viewcontroller值。

就像如果第一个 ViewController 去然后放置 0。如果第二个 ViewController 去然后放置 1。如果第三个 ViewController 去然后放置 2。

于 2013-05-30T12:01:11.280 回答