如何在IPhone窗口应用程序中显示另一个窗口 [英] How do I show another window in an IPhone window application
问题描述
首先,我是Objective-C和IPhone编程的新手。有一些我不能上班。我有一个IPhone窗口应用程序,在MainWindow我有一个按钮。我想点击按钮时显示另一个窗口。我绑定了我的控制器的事件。我只是不知道如何显示我的其他窗口(otherWindow)在事件中。
First of all, I'm new to Objective-C and IPhone programming. There is somehing I can not get to work. I have a IPhone window application and in the MainWindow I have a button. I want to show another window when I click the button. I've bind the event with my controller. I just don't know how to show my other window (otherWindow) in the event.
任何人都可以指导这样做吗?谢谢
Anyone can guide to do this ? Thank you
推荐答案
这是将 UIView
添加到单击按钮时的窗口:
This is an example of adding a UIView
to your Window when a button is clicked:
- (IBAction)buttonClicked:(id)sender
{
UIView *newView = [[NewView alloc] initWithFrame:CGRectMake(250, 60, 500, 600)];
[self.view addSubview:newView];
[newView release];
}
这是一个推送新视图的示例(假设您使用navigationController:
This is an example of pushing a new view (assuming you're using a navigationController:
LoginViewController *viewController = [[LoginViewController alloc] initWithNibName:@"LoginView" bundle:nil];
[self.navigationController pushViewController:viewController animated:YES];
[viewController release];
$ b b
这是一个呈现新视图(模态窗口)的示例:
And this is an example of presenting a new view (modal window):
FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil];
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];
[controller release];
这篇关于如何在IPhone窗口应用程序中显示另一个窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!