【发布时间】:2011-04-27 10:49:57
【问题描述】:
我正在做一个项目,我必须预先选择一个特定的单元格。
我可以使用-willDisplayCell 预先选择一个单元格,但是当用户单击任何其他单元格时我无法取消选择它。
- (void)tableView:(UITableView*)tableView
willDisplayCell:(UITableViewCell*)cell
forRowAtIndexPath:(NSIndexPath*)indexPath
{
AppDelegate_iPad *appDelegte =
(AppDelegate_iPad *)[[UIApplication sharedApplication] delegate];
if ([appDelegte.indexPathDelegate row] == [indexPath row])
{
[cell setSelected:YES];
}
}
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
AppDelegate_iPad *appDelegte =
(AppDelegate_iPad *)[[UIApplication sharedApplication] delegate];
NSIndexPath *indexpath1 = appDelegte.indexPathDelegate;
appDelegte.indexPathDelegate = indexPath;
[materialTable deselectRowAtIndexPath:indexpath1 animated:NO];
}
你能帮忙吗?
【问题讨论】:
-
这个问题需要有一个公认的答案
标签: ios objective-c iphone uitableview interface-builder