2010-04-07 74 views

回答

1

我相信箭頭是由彈窗視圖本身自動放置的。因此,無論您設置彈出窗口的框架,它都會將箭頭放在頂部並居中。

5

您可以定義您希望彈出窗口指向的CGRect。

CGPoint point = ...; // where they tapped on screen, taken from UIEvent, if you like 
CGSize size = ...; // give a size range, maybe the size of your table cell 
[popover presentPopoverFromRect:CGRectMake(point.x, point.y, size.width, size.height) 
inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 
3

嘗試使用以下方法獲取所選行的CGRect。

CGRect selectedRect = [self.tableView rectForRowAtIndexPath:indexPath];

然後使用矩形時呈現UIPopoverController:

[myPopover presentPopoverFromRect:selectedRect ............. inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft動畫:YES];

相關問題