Ash*_*raf 3 iphone uitableview ipad uipopovercontroller ios
我想以编程方式在表视图中选择一行,然后显示我的弹出框,让箭头指向单元格.
当表没有滚动时,此代码工作正常,对于滚动表视图,弹出箭头定位不正确.
[self.EventsTableView selectRowAtIndexPath:indexPath
animated:YES
scrollPosition:UITableViewScrollPositionMiddle];
[popoverController presentPopoverFromRect:CGRectOffset(cell.frame, 0, cell.frame.size.height + self.EventsTableView.contentOffset)
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionLeft
animated:YES];
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助
一旦用户向下滚动列表,上述方法似乎对我不起作用。找到相对于滚动量的单元格位置是诀窍。
CGRect rect = [tableView convertRect:[tableView rectForRowAtIndexPath:indexPath]
toView:tableView];
[popoverController presentPopoverFromRect:rect
inView:tableView
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4688 次 |
| 最近记录: |