Моя камера вылетает на ipad 12.1.4, но на iphone работает нормально

<style>
    #text_orientation{
        writing-mode:tb-rl;
        transform: rotate(90deg);
        white-space:nowrap;
        display:block;
        bottom:0;
        width:20px;
        height:20px;
    }
</style>
</head>
<body>

<p id="text_orientation">Welcome</p>
</body>

-1
задан Imran Aftab 4 March 2019 в 08:21
поделиться

2 ответа

Так как Apple объявляет, что iOS-приложение должно нормально работать и в ipad. Итак, нам нужно убедиться, что когда мы снимаем фотографию с камеры и выбираем из библиотеки фотографий, нам также необходимо обновить код для iPad относительно UIImagePickerViewController. Я прилагаю код, который работает как на iPhone, так и на iPad.

let actionSheetController: UIAlertController = UIAlertController(title: "Select Photo", message: "", preferredStyle: .actionSheet)

    let cancelActionButton: UIAlertAction = UIAlertAction(title: "Cancel", style: .cancel) { action -> Void in
        print("Cancel")
    }
    actionSheetController.addAction(cancelActionButton)


    let saveActionButton: UIAlertAction = UIAlertAction(title: "Photolibrary", style: .default)
    { action -> Void in

        self.picker.allowsEditing = true
        self.picker.sourceType = .photoLibrary
        self.present(self.picker, animated: true, completion: nil)

    }
    actionSheetController.addAction(saveActionButton)

    let deleteActionButton: UIAlertAction = UIAlertAction(title: "Camera", style: .default)
    { action -> Void in

        if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera)
        {
            self.picker.allowsEditing = true
            self.picker.sourceType = .camera
            self.present(self.picker, animated: true, completion: nil)
        }

    }

    actionSheetController.addAction(deleteActionButton)

    if let popoverController = actionSheetController.popoverPresentationController {

        popoverController.sourceView = self.view
        popoverController.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 0, height: 0)
        popoverController.permittedArrowDirections = []
    }
    self.present(actionSheetController, animated: true, completion: nil)
0
ответ дан Maulik Vekariya 4 March 2019 в 08:21
поделиться

Я думаю, что ваша ошибка в UIAlertController , потому что в iPad вам нужно передать исходное представление.

Пожалуйста, проверьте код UIAlertController для iPad

if let popoverController = yourAlert.popoverPresentationController {
                popoverController.sourceView = self.view //to set the source of your alert
                popoverController.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 0, height: 0) // you can set this as per your requirement.
                popoverController.permittedArrowDirections = [] //to hide the arrow of any particular direction
            }

Вы можете проверить этот код также в своем симуляторе, пожалуйста, проверьте сначала и повторно отправьте свою сборку.

0
ответ дан Vivek 4 March 2019 в 08:21
поделиться
Другие вопросы по тегам:

Похожие вопросы: