Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iphone导航控制器_Iphone_View_Uinavigationcontroller - Fatal编程技术网

iphone导航控制器

iphone导航控制器,iphone,view,uinavigationcontroller,Iphone,View,Uinavigationcontroller,我正试图更好地了解UINavigationController。我有3.XIB。从.xib1我推到.xib2。我必须将数据从.xib1传递到.xib2 Controller1 *selectcity = [[Controller1 alloc]initWithNibName:@"Controller1" bundle:nil]; selectcity.item1 = @"hi"; // Push the next view onto our stack [self.navigationC

我正试图更好地了解UINavigationController。我有3.XIB。从.xib1我推到.xib2。我必须将数据从.xib1传递到.xib2

Controller1 *selectcity = [[Controller1 alloc]initWithNibName:@"Controller1" bundle:nil];   

selectcity.item1 = @"hi";
// Push the next view onto our stack
[self.navigationController pushViewController:selectcity animated:YES];
[selectcity release];
每次打开该视图时,我都需要将一些数据传递给.xib2。每当用户选择表中的一行时,将一个新视图推到堆栈上,然后按后退,选择一行,后退,选择一行,后退,这会很快创建一个内存警告并终止应用程序

如果我将视图添加为属性并检查它是否已经存在

if (xib2 == nil) {

}
viewDidLoad方法仅在第一次调用视图时才被调用,因此我无法将数据传递给表单

我不能使用ViewDidDisplay等,因为我不想在从.xib3返回时加载数据

在这种情况下,控制内存的正确方法是什么?我应该在他们每次按下后退按钮时从堆栈中弹出xib2吗?如果是这样,我会用什么方法来做呢

谢谢你的帮助

我想找个更好的 理解 UINavigationController。我有三个 希布斯先生。从.xib1我正在推到 .2。我必须将数据传递给.xib2 从.xib1开始

Controller1 *selectcity = [[Controller1 alloc]initWithNibName:@"Controller1" bundle:nil];   

selectcity.item1 = @"hi";
// Push the next view onto our stack
[self.navigationController pushViewController:selectcity animated:YES];
[selectcity release];
首先,您不会在.xib之间传递数据,而是在视图控制器之间传递数据

我需要将一些数据传递给.xib2 每次打开该视图时。推 每次都会在堆栈上显示一个新视图 用户在表中选择一行, 然后按back,选择一个 行,后退,选择一行,后退 快速创建记忆警告 并终止应用程序

请发布更多与此问题相关的代码。假设您谈论的是UITableView行,那么您的应用程序在点击行时将视图推/弹出到导航堆栈上应该不会有任何问题

viewDidLoad方法仅获取 第一次调用视图时调用 已调用,因此我无法将数据传递给 形式

同样,您希望在视图控制器(而不是视图)之间传递数据。通过在视图控制器上创建属性,然后在将视图控制器推送到堆栈上之前设置属性,可以非常轻松地完成此操作。我认为,您已经在使用item1属性执行此操作

正确的控制方法是什么 这种情况下的记忆?我应该是吗 每次从堆栈中弹出xib2 他们按下后退按钮了吗?是这样,, 我用什么方法来做这件事

如果您使用标准的UINavigationController来控制导航堆栈,那么当用户点击后退按钮时,您无需自行管理内存;UINavigationController类将负责释放视图控制器本身