【发布时间】:2011-09-28 22:06:41
【问题描述】:
I've got a menu that's a UITableview in a UIPopovercontroller that when selected scrolls the parent view's UIScollView to a specific frame.
效果很好。
问题是如果你使用pageControl滚动框架我需要更新表格中选中的行[_delegate returnPageNumber]返回当前pageControl.currentPage
没有错误,NSLog 正在报告正确的页码:
scrollIndexPath is <NSIndexPath 0x1a3380> 2 indexes [0, 3]
但是正确的单元格没有突出显示...为什么????
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
//[tableView reloadData];
int isPage = [_delegate returnPageNumber];
NSIndexPath *scrollIndexPath = [NSIndexPath indexPathForRow:(isPage) inSection:0];
NSLog(@"scrollIndexPath is %@",scrollIndexPath);
[tableView selectRowAtIndexPath:scrollIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
}
我尝试在之前和之后放置 [tableView reloadData] 并将代码放在 viewDidAppear 中......没有任何效果
【问题讨论】:
-
你为什么不使用 -didSelectRowAtIndexPath?
标签: ios ipad uitableview uipopovercontroller