如何使用UIPopoverArrowDirectionRight或UIPopoverArrowDirectionLeft从UITableViewCell正确显示弹出窗口 [英] How to correctly present a popover from a UITableViewCell with UIPopoverArrowDirectionRight or UIPopoverArrowDirectionLeft
本文介绍了如何使用UIPopoverArrowDirectionRight或UIPopoverArrowDirectionLeft从UITableViewCell正确显示弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我总是尝试以这种方式从tableView中的单元格呈现一个popover:
I always try to present a popover from a cell inside a tableView this way:
[myPopover presentPopoverFromRect:cell.frame inView:self.tableView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
但我不能使用UIPopoverArrowDirectionRight或Left,因为,取决于ipad的位置
(肖像或风景),popover出现在其他地方。
but I cannot use UIPopoverArrowDirectionRight or Left, because, depending on the position of the ipad (portrait or landscape), the popover appears someplace else.
我是否以正确的方式呈现popover?
Am I presenting the popover the right way?
PS:表视图位于splitView的detailView中。
PS: the table view is in the detailView of a splitView.
推荐答案
这是一个对我来说很好的简单解决方案
Here is the simple solution which works fine for me
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
CGRect rect=CGRectMake(cell.bounds.origin.x+600, cell.bounds.origin.y+10, 50, 30);
[popOverController presentPopoverFromRect:rect inView:cell permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
这篇关于如何使用UIPopoverArrowDirectionRight或UIPopoverArrowDirectionLeft从UITableViewCell正确显示弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文