gpt4 book ai didi

iphone - 如何在 iPhone 窗口应用程序中显示另一个窗口

转载 作者:行者123 更新时间:2023-12-03 20:22:28 24 4
gpt4 key购买 nike

首先,我是 Objective-C 和 iPhone 编程的新手。有事我无法去上类。我有一个 iPhone 窗口应用程序,在主窗口中有一个按钮。我想在单击按钮时显示另一个窗口。我已将事件与我的 Controller 绑定(bind)。我只是不知道如何在事件中显示我的另一个窗口(otherWindow)。

任何人都可以指导这样做吗?谢谢

最佳答案

这是在单击按钮时向窗口添加 UIView 的示例:

- (IBAction)buttonClicked:(id)sender 
{
UIView *newView = [[NewView alloc] initWithFrame:CGRectMake(250, 60, 500, 600)];
[self.view addSubview:newView];
[newView release];
}

这是推送新 View 的示例(假设您使用的是 navigationController:

LoginViewController *viewController = [[LoginViewController alloc] initWithNibName:@"LoginView" bundle:nil];

[self.navigationController pushViewController:viewController animated:YES];
[viewController release];

这是呈现新 View (模式窗口)的示例:

FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil];

controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];

[controller release];

关于iphone - 如何在 iPhone 窗口应用程序中显示另一个窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3852349/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com