如何在长按图像时禁用UIImagePickerController中的复制/隐藏功能......?

时间:2015-06-22 11:26:25

标签: ios swift ios8 uiimagepickercontroller ios8.3

enter image description here - 实际上我正在使用UIImagePickerController作为我的用例,如果我长按任何图片,它会显示复制/隐藏选项(如示例图片所示)

   - I dont want the Copy/Hide feature. 

如果你也遇到过一些建议,请引导我:)......

提前致谢... iOS Geeks ... PLZ请参阅下面的代码片段....

 ![@IBAction func allPhotosItemButtonPressed(sender: UIBarButtonItem) {
        let imagePicker: UIImagePickerController = UIImagePickerController()
        imagePicker.delegate = self
        imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
        let popOver: UIPopoverController = UIPopoverController(contentViewController: imagePicker)
        popOver.presentPopoverFromBarButtonItem(sender, permittedArrowDirections: UIPopoverArrowDirection.Any, animated: true)
    }![enter image description here][1]

2 个答案:

答案 0 :(得分:3)

它的方向问题。 UIImagePickerController  不支持横向模式..

试试这段代码 source :: https://gist.github.com/mkeremkeskin/0ed9fc4a2c0e4942e451

- (BOOL)shouldAutorotate {

    UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];

    if ( orientation == UIDeviceOrientationPortrait
        | orientation == UIDeviceOrientationPortraitUpsideDown) {

        return YES;
    }

    return NO;
}

- (NSUInteger)supportedInterfaceOrientations {

    return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown);
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    UIDevice* device = [UIDevice currentDevice];
    if (device.orientation == UIInterfaceOrientationPortraitUpsideDown) {
        return UIInterfaceOrientationPortraitUpsideDown;
    }
    return UIInterfaceOrientationPortrait;
}

答案 1 :(得分:2)

你必须实施自己的自定义图像pickercause我不认为你要求的是什么