xcode 如何从按钮导航到另一个页面
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/560081/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How I can navigate to another page from a button
提问by ashish
I am new at the area of Objective-C and am building an iphone app using Xcode. I have taken two buttons on a page and from among one I would like to go to another page. How is it possible at Xcode?
我是 Objective-C 领域的新手,正在使用 Xcode 构建一个 iphone 应用程序。我在一个页面上取了两个按钮,我想从其中一个按钮转到另一页。在Xcode怎么可能?
回答by Md Nasir Uddin
You can try it.
你可以试试看。
EnterNameController *newEnterNameController = [[EnterNameController alloc] initWithNibName:@"EnterNibFileName" bundle:[NSBundle mainBundle]];
[[self navigationController] pushViewController:newEnterNameController animated:YES];
回答by mhrrt
EnterNameController *newEnterNameController = [[EnterNameController alloc] initWithNibName:@"EnterNibFileName" bundle:[NSBundle mainBundle]];
[[self navigationController] pushViewController:newEnterNameController animated:YES];
[newEnterNamecontroller release];
This one is more accurate as far as i know.
据我所知,这个更准确。
回答by Vincent Wang
You can try
你可以试试
TwoViewController * twoVC = [[TwoViewController alloc] init];
[self.navigationController pushViewController:twoVC animated:YES];
"TwoViewController" is a custom UIViewController
“TwoViewController”是一个自定义的 UIViewController
回答by bentford
Get the book "Beginning iPhone Development"and go through it from start to finish without skipping anything.
获取“开始 iPhone 开发”一书,从头到尾通读一遍,不要跳过任何内容。
回答by August
This type of thing is a basic building block of iPhone apps, and Apple provides plenty of sample code that shows how to do it.
这种类型的东西是 iPhone 应用程序的基本构建块,Apple 提供了大量示例代码来展示如何做到这一点。
Start by looking at the UICatalog sample project.
首先查看 UICatalog 示例项目。