iOS camera UIView overlay full screen on iPad?

守給你的承諾、 提交于 2020-01-14 06:43:15

问题


I'm trying to make an overlay on the camera mode on iPad. when the camera is in landscape mode, the overlay only covers 2/3 of the screen instead of the full screen. It is covering the whole screen in portrait mode however. My guess is the overlay could possibly be only showing in portrait size so that the overlay doesn't appear to be covering the full screen.

UIView *overlay = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

overlay.backgroundColor = [UIColor blueColor];
overlay.alpha = 0.3; 
overlay.opaque = NO;

imagePicker.mediaTypes = mediaTypes;
imagePicker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
imagePicker.modalPresentationStyle = UIModalPresentationFullScreen;


imagePicker.cameraOverlayView = overlay;

However can i make it to cover the whole screen? Any help will be appreciated.


回答1:


Do manual setting for view frame. when it rotate to Portrait or Landscape.

For Portrait CGRectMake(0,0,768,1024);

For Landscape CGRectMake(0,0,1024,768);



来源:https://stackoverflow.com/questions/11448631/ios-camera-uiview-overlay-full-screen-on-ipad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!