UIImagePickerController iPad 问题
我有以下代码:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] initWithRootViewController:self];
imagePicker.delegate = self;
popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
[imagePicker release];
[popover presentPopoverFromRect:CGRectMake(100, 100.0, 0.0, 0.0)
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
但这只会破坏 self.view 并且根本不显示任何内容。当我将 inView: 设置为 [self.view window]
时,选择器至少会显示出来。但它仍然删除了 self.view。我必须做什么才能使视图不会消失?
I have the following code:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] initWithRootViewController:self];
imagePicker.delegate = self;
popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
[imagePicker release];
[popover presentPopoverFromRect:CGRectMake(100, 100.0, 0.0, 0.0)
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
But this only destroys the self.view
and does not show anything at all. When I set the inView: to [self.view window]
the picker at least shows up. But it still removes the self.view. What do I have to do that the view doesn't disappear?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您初始化 UIImagePickerController 错误。尝试将其更改为
You are initializing the UIImagePickerController wrong. Try changing it to
您正在尝试使用该视图本身在视图内显示弹出窗口!
initWithRootViewController 是要在弹出窗口中显示的视图(控制器)。
inview 是弹出窗口的视图
You are trying to show a popup inside a view with that view itself!
initWithRootViewController is the view(controller) to show inside the popup.
inview is the view where the popup will pop up