2

我正在使用一个MPVolumeView. 我在viewDidLoad方法中有这个代码

MPVolumeView *volumeView = [[MPVolumeView alloc] init];
volumeView.center =  self.view.center;
volumeView.showsVolumeSlider = NO;
[self.view addSubview:volumeView];

即使视图中没有其他元素,弹出框也太小了。

在此处输入图像描述

有没有办法更改/指定弹出框的大小MPVolumeView

谢谢。

4

2 回答 2

0
    MPVolumeView *mpVolumeView = [[MPVolumeView alloc] initWithFrame:CGRectMake( self.view.center.x, self.view.center.y, 90, 70)];

    mpVolumeView .transform = CGAffineTransformMakeScale(1.4, 1.4); // increase its size 

   mpVolumeView .showsVolumeSlider = NO;
   [self.view addSubview:mpVolumeView ];
于 2015-04-30T17:54:41.263 回答
0

您可以在根视图控制器方法中覆盖 presentViewController 方法,并为呈现控制器设置 preferredContentSize:

- (void)presentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion {
    viewControllerToPresent.preferredContentSize = CGSizeMake(320, 100);
    [super presentViewController:viewControllerToPresent animated:flag completion:completion];
}
于 2015-06-05T13:57:06.157 回答