UIAlertView中的MPVolumeView? [英] MPVolumeView in a UIAlertView?
问题描述
是否可以在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屋!