gpt4 book ai didi

ios - iphone 如何推送浏览量?

转载 作者:行者123 更新时间:2023-11-28 23:14:40 24 4
gpt4 key购买 nike

我是 iPhone 开发的新手,我需要一些指导来插入观点。我有以下应用场景“按下按钮->切换 View (包含表格)->按下表格单元格->切换 View ”。

要在按下按钮时切换,我使用以下代码:

MapView *screen = [[MapView alloc] initWithNibName:nil bundle:nil];
screen.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:screen animated:YES];
[screen release];

然后为了推送另一个 View ,我想使用这段代码(但它不起作用 - 我问为什么?)

Newclass *nextController = [[Newclass alloc] initWithItem:theItem];
[self.navigationController pushViewController:nextController animated:YES];
[nextController release];

最佳答案

您想从您的 MapView 推送这个 View 吗?看起来您没有像那样推送 View Controller 所需的 UINavigationController。

更新代码的第一部分以将 MapView 放入 UINavigationController 中,然后您可以使用第二部分代码将其他 View 推送到它上面。

MapView *screen = [[MapView alloc] initWithNibName:nil bundle:nil];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:screen]; // this puts the MapView onto navigation controller
navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; // you will present the navController instead of screen so change it's modalTransitionStyle
[self presentModalViewController:navController animated:YES]; // present it
[screen release];
[navController release]; // don't forget to release

关于ios - iphone 如何推送浏览量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6975081/

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