UIPopoverController for iPad

来源:互联网 发布:好用的ss代理 知乎 编辑:程序博客网 时间:2024/06/08 05:54

1:通过ViewController初始化

popoverColorPicker = [[UIPopoverController alloc] initWithContentViewController:colorPickerViewController];

2:设置UIPopoverController的内容大小(一般设置ViewController的大小即可)

[popoverColorPicker setPopoverContentSize:colorPicker.frame.size animated:YES];

3:显示出来

[popoverColorPicker presentPopoverFromRect:btn.frame inView:self.toolbarBrush permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];

参数解释:

presentPopoverFromRect: UIPopoverController显示的具体位置

inView:基于哪一个父视图来显示位置.

permittedArrowDirections:箭头的出现位置