Using UIImagePickerController in landscape orientation

后端 未结 8 698
暗喜
暗喜 2020-11-28 09:55

I am creating an app which is in landscape mode and I am using UIImagePickerController to take photos using iPhone camera in it and I want to create it in lands

8条回答
  •  醉酒成梦
    2020-11-28 10:18

    The correct way to use UIImagePickerController in landscape mode without any hacks is to put it into a UIPopoverController

    - (void)showPicker:(id)sender
    {
        UIButton *button = (UIButton *)sender;
        UIImagePickerController *picker = [[UIImagePickerController alloc] init];
        picker.delegate = self;
        picker.allowsEditing = YES;
        picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    
        _popover = [[UIPopoverController alloc] initWithContentViewController:picker];
        [_popover presentPopoverFromRect:button.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    }
    

提交回复
热议问题