本文介绍了如何使用 UIPopoverArrowDirectionRight 或 UIPopoverArrowDirectionLeft 从 UITableViewCell 正确呈现弹出框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我总是尝试以这种方式从 tableView 中的单元格显示一个弹出框:
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(纵向或横向),弹出框出现在其他地方.
but I cannot use UIPopoverArrowDirectionRight or Left, because, depending on the positionof the ipad (portrait or landscape), the popover appears someplace else.
我是否以正确的方式呈现弹出框?
Am I presenting the popover the right way?
PS:table view在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 正确呈现弹出框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!