不确定是否有人知道UITableViewCells经常被重用的数量是否存在实际限制.?首先,我很清楚所有的Obj-C / Apple内存管理规则(我将首先说明这一点,所以我没有浪费任何人的时间,他们也没有浪费我的时间)
所以我会直截了当地问这个。对于重用UITableViewCell的“自动释放”机制是否有一些实际的限制?因为我似乎只是在经历了一定数量的崩溃,通常超过50页的单元格(大约50页+ 50单元)被翻转.那我就从哪弄到这起车祸..。有时根本不发生,有时发生得很频繁,取决于内容密度.
我自己开始手动保存和释放会更好吗?如果是这样的话,会不会有人有经验推荐一个好的地方来释放他们。
[tableview tableView:cellForRowAtIndexPath:]: message sent to deallocated instance 0x14e0a920好吧..。我未能找到与实际的UITableViewCell (单元格内容或单元本身)有任何关系,但是在将一些保留添加到控制器(它实例化UITableView对象)之后,“崩溃”神秘地停止了.
这是我改变的。基本上,我添加了三条保留语句,顺便说一句,我使用了自称为"Iphone专家“的”如何“- "UITabBarController”的原始示例教程,但是“专家”否定了包含保留.。(这只是代码的适用部分.)
//initialize the UITabBarController
tabBarController = [[UITabBarController alloc] init];
TabBarControllerSet = TRUE;
//Create the first UITabBarItem
MainMessageBoard *mainMessageBoard = [[MainMessageBoard alloc] initWithController: self];
[mainMessageBoard setTitle:@"?????"];
[mainMessageBoard retain]; ////******** ADDED This RETAIN ***********
//Create the second UITabBarItem
PostNewComment *postNewComment = [[PostNewComment alloc] initWithController: self];
[postNewComment setTitle:@"????"];
[postNewComment retain]; ////******** ADDED This RETAIN ***********
//Create the third UITabBarItem
logout *Logout = [[logout alloc] initWithController: self];
[Logout setTitle:@"?????"];
[Logout retain]; ////******** ADDED This RETAIN ***********
//add the UIViewControllers to the UITabController
tabBarController.viewControllers = [NSArray arrayWithObjects:mainMessageBoard, postNewComment, Logout, nil];
[tabBarController setDelegate:self];
//release
[mainMessageBoard release];
[postNewComment release];
[Logout release];
[self.view addSubview:tabBarController.view];发布于 2011-05-06 09:10:39
AFAIK --它只受设备上空闲内存的限制--我假设它在自动释放池和表视图的可重用单元中使用某种动态集(即NSSet或较低级别的等效单元)。
我使用了数以万计行的表视图,没有任何问题。
https://stackoverflow.com/questions/5908690
复制相似问题