我正在使用tabbar应用程序。也许这是一个微不足道的问题,但我只是简单地想要替换UITableViewCell的labelvalue。我从TextView获取NSString,嵌入在UITableView“输入”中。我想要修改的单元在“输入”视图的父视图内。 修改应该在保存功能中进行。
访问导航堆栈内不同UITableView的特定UITableViewCell
- (void)save:(id)sender
{
//Get the needed string
DescriptionViewCell *cell = (DescriptionViewCell *) [descriptionTable cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
NSString *temp = [[NSString alloc]initWithString:[cell.textView text]];
//Access parentview
FindTableViewController *rootController = [self.navigationController.viewControllers objectAtIndex:1];
UITableViewCell *descriptionCell = [rootController.findUITable cellForRowAtIndexPath: [NSIndexPath indexPathForRow:0 inSection: 1]];
//replace label string
descriptionCell.textLabel.text = temp;
[temp release];
//return to parentview
[self.navigationController popViewControllerAnimated:YES];
}
不幸的是,descriptionCell不包含任何数据,修改不会发生。你看到我的代码中有任何问题,或者我应该与索引“玩”吗?
在此先感谢。
干杯,
西蒙
您是否尝试添加NSLog语句并打印出temp值? – Sabobin 2011-04-06 13:37:48