UIPopoverController 中的 UIImagePickerController - 位置不起作用 [英] UIImagePickerController in UIPopoverController - location not working

查看:24
本文介绍了UIPopoverController 中的 UIImagePickerController - 位置不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我编写的 iPad 应用程序中,我在静态表格单元格中有按钮,可以在弹出框内启动图像选择器.

In an iPad app I'm writing I have button in a static table cell that launches an image picker inside a popover.

我希望弹出框的箭头指向启动弹出框的按钮.现在,当我点击按钮时它没有.它在屏幕上抛出弹出窗口(使用工作图像选择器),但箭头要么指向屏幕顶部,要么指向其他任何地方(无法确定它是否随机——见下文).

I want the popover's arrow to point at the button that launched the popover. Right now, when I tap the button it doesn't. It throws the popover on screen (with the working image picker) but the arrow either points to the top of the screen or kind of anywhere else (can't figure out if it's random or not--see below).

包含按钮的静态单元格的 tableview 已禁用滚动,但位于滚动视图上.这会导致随机箭头位置吗?

The tableview that holds the static cell that contains the button has its scroll disabled but is located on a scroll view. Could that cause random arrow locations?

这是我的代码:

// present image picker in a popover
_imagePicker = [[UIImagePickerController alloc] init];
_imagePicker.delegate = self;
_imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
_imagePicker.allowsEditing = NO;
_imagePicker.navigationBar.tintColor = [UIColor redColor];
_imagePicker.navigationBar.backgroundColor = [UIColor greenColor];
_popover = [[UIPopoverController alloc] initWithContentViewController:_imagePicker];
[_popover presentPopoverFromRect:self.theButton.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

有人可以解释为什么箭头没有指向按钮的框架和/或如何修复它吗?

Can someone please explain why the arrow isn't pointing at the button's frame and/or how to fix it?

谢谢.

推荐答案

该按钮可能不是 self.view 的直接子视图.

The button is likely not a direct subview of self.view.

试试:

[_popover presentPopoverFromRect:self.theButton.frame inView:self.theButton.superview permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

这篇关于UIPopoverController 中的 UIImagePickerController - 位置不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆