在xcode中从一个页面导航到另一个页面
虽然你的问题是没有多少明确的,但我还是想给一个尝试...
您可以使用
UIViewController *yourViewController = [[YourViewControllerClass alloc] initWithNibName:@"<name of xib>" bundle:nil];
[self presentModalViewController:yourViewController animated:YES];
[yourViewController release];
在情况下,新观点也是以编程方式创建的,则能做到这一点在YourViewControllerClass的viewDidLoad方法,改变初始化
UIViewController *yourViewController = [[YourViewControllerClass alloc] init];
在YourViewController当你想回来以前查看O ñ一些按钮操作,您可以使用
[self dismissModalViewControllerAnimated:YES];
的另一种方式,你可以做的是
UIViewController *yourViewController = [[YourViewControllerClass alloc] init];
[self addSubview:[yourViewController view]];
,并删除您可以使用
[self.view removeFromSuperview];
希望这对你的作品的看法,如果是请沟通.... :)
PLS更加精确。
如果您正在使用的视图控制器内navigationcontroller你可以利用它的pushViewController:
或presentModalViewController:
的。或者,如果您只想显示另一个视图,则只需将现有视图的下一个视图添加为子视图即可。
我是新来的iphone应用程序开发。我的应用程序中有一个按钮。如果我按下那个按钮,我想进入下一页。我不想为此使用界面生成器。我必须以编程方式进行。如果你有时间意味着请给予编码......提前致谢。 – Aravindhan 2011-03-21 09:16:04
你的应用有导航控制器吗? – visakh7 2011-03-21 09:36:27
亚我在我的应用程序中有navigavion conroller – Aravindhan 2011-03-21 09:55:50
//Appdelegate.m
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
UINavigationController *navigation = [[UINavigationController alloc]initWithRootViewController:self.viewController];
self.window.rootViewController = navigation;
[self.window makeKeyAndVisible];
return YES;
}
//In viewcontroller1.M
- (IBAction)GoToNext:(id)sender
{
ViewController2 *vc2 = [[ViewController2 alloc] init];
[self.navigationController pushViewController:vc2 animated:YES];
}
更多的问号,你每个句子后,把少你的机会来得到答案。真的 – Vladimir 2011-03-21 09:01:21
你的问题是什么? – Rog 2011-03-21 09:03:43