UIAlertView中的MPVolumeView? [英] MPVolumeView in a UIAlertView?

查看:97
本文介绍了UIAlertView中的MPVolumeView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在UIAlertView中放置一个MPVolumeView?

Is it possibe to put an MPVolumeView in a UIAlertView?

我试图放入其中,但它没有显示。它可能是 sizeToFit initWithFrame:部分?
有没有办法测试 MPVolumeView 是否真正被创建?

I have tried to put it inside of it, but it does not display. It may be the sizeToFit or initWithFrame: part? Is there a way of testing if the MPVolumeView is actually being created?

这是代码我使用以下内容初始化 UIAlertView MPVolumeView

Here's the code I initialize both the UIAlertView and MPVolumeView with:

UIAlertView *volumeAlert = [[UIAlertView alloc] initWithTitle:@"Volume" message:@"" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];

MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame:volumeAlert.bounds];

[volumeAlert addSubview:volumeView]; 

[volumeAlert sizeToFit];

[volumeAlert show];
[volumeAlert release];
[volumeView release];


推荐答案

我认为使用VolumeAlert的框架启动VolumeView会导致问题。由于VolumeAlert的帧永远不会被设置(在设置VolumeView的帧之前),因此您不能依赖它的任何大小。

I think initing the VolumeView with the VolumeAlert's frame would cause problems. Since VolumeAlert's frame is never being set (before VolumeView's frame is set), you can't depend on it being any size.

这篇关于UIAlertView中的MPVolumeView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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