iPad 上的 MPMediaPickerController - 视图底部不接受触摸事件

发布于 2024-09-30 00:53:59 字数 838 浏览 1 评论 0原文

我在 iPad 上使用此媒体选择器时遇到了一些问题...我可以在新的基于视图的应用程序中轻松地重现该问题。

1) 在 XCode 中为 iPad 创建新的基于视图的应用程序

2) 打开视图控制器的源代码并添加以下内容

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    MPMediaPickerController *picker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeAnyAudio];
    picker.allowsPickingMultipleItems   = NO;
    picker.prompt = NSLocalizedString (@"Select a song to play", "Prompt in media item picker");
    [self presentModalViewController:picker animated:YES];
    [picker release];
}

就是这样。当我运行生成的应用程序时,我发现无法激活底部选项卡栏上的任何内容。我也无法选择表格视图中底部 4 个项目中的任何一个。

还有其他人遇到过这个问题并找到解决方法吗?

===

另外,我尝试使用 UIModalPresentationStyleFormPage 模式来呈现选择器,但是虽然这很有效,但它最终会显示得很奇怪,并且对于我的应用程序来说是不可接受的。如果有人知道如何以 FormPage 样式正确居中这个东西,那也可以解决问题,至少对我来说是这样。

I'm having some trouble with this Media picker on iPad... I can easily recreate the problem in a fresh View-based application.

1) Create new View-Based application for iPad in XCode

2) Open the source for the View Controller and add the following

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    MPMediaPickerController *picker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeAnyAudio];
    picker.allowsPickingMultipleItems   = NO;
    picker.prompt = NSLocalizedString (@"Select a song to play", "Prompt in media item picker");
    [self presentModalViewController:picker animated:YES];
    [picker release];
}

That's it. When I run the resulting application, I find I am unable to activate anything on the bottom tab bar. Neither am I able to select any of the bottom 4 items in the table view.

Has anyone else encountered this problem and found a way around it?

===

Also, I tried presenting the picker using the UIModalPresentationStyleFormPage mode, but while that is functional, it ends up getting displayed oddly and won't be acceptable for my app. If anyone knows a way to properly center this thing in FormPage style, that would also solve the problem, at least for me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倥絔 2024-10-07 00:53:59

我花了几天时间在这个问题上,最后我放弃了,用的

        picker.modalPresentationStyle = UIModalPresentationPageSheet;
    picker.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

不是那么大,但让我克服了这个问题。希望这有帮助

I spent a couple days on this and I finally gave up and used

        picker.modalPresentationStyle = UIModalPresentationPageSheet;
    picker.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

not as big but gets me over this problem. Hope this helps

渔村楼浪 2024-10-07 00:53:59

正确的方法可能是在弹出窗口中显示选择器,效果很好。尽管没有记录,但这可能是您应该做的;许多其他内置选择器视图控制器当然也是这种情况。

The correct approach is probably to present the picker in a popover, which works fine. Though not documented, this is probably what you're expected to do; it is certainly the case with many other built-in picker view controllers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文