问题
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