ios - Horizontal Camera with Overlay -
i need have horizontal video camera input image overlays (that not recorded).
the problem that, when active, camera view rotated 90 degrees though else correctly oriented horizontally.
uiimagepicker cannot horizontal orientation, , i've had trouble using avcapture graphic overlays. so, use custom view , rotate that.
camera init
if ([uiimagepickercontroller issourcetypeavailable:uiimagepickercontrollersourcetypecamera]) { //custom view instead of uiimagepicker _video_picker = [[vcimagepickercontroller alloc] init]; _video_picker.delegate = self; _video_picker.allowsediting = yes; _video_picker.sourcetype = uiimagepickercontrollersourcetypecamera; _video_picker.cameradevice = uiimagepickercontrollercameradevicefront; _video_picker.mediatypes = [[nsarray alloc] initwithobjects: (nsstring *) kuttypemovie, nil]; _video_picker.showscameracontrols = no; //set orientation _video_picker.modalpresentationstyle = uimodalpresentationcurrentcontext; //display overlay graphics _video_picker.cameraoverlayview = _overvw ; [self.navigationcontroller presentviewcontroller:_video_picker animated:no completion:nil]; then in custom vcimagepickercontroller view, mask set:
- (bool)shouldautorotate { return yes; } -(uiinterfaceorientationmask)supportedinterfaceorientations { return uiinterfaceorientationmasklandscape; } - (uiinterfaceorientation)preferredinterfaceorientationforpresentation { return uiinterfaceorientationlandscaperight; } when camera in horizontal mode, rendered view out of sync. mask appears, actual camera view incorrect. when move camera right, goes down, if orientation rotated. using iphone 6 ios 9.2.1.
if helps anyone, make horizontal uiimagepicker , must create entirely custom view.
Comments
Post a Comment