Popover in Swift 3 auf iPhone ios

Ich versuche, ein popover-Menü mit dem folgenden code:

import UIKit

class BeobachtungViewController: UIViewController, UIPopoverPresentationControllerDelegate {


    @IBAction func addClicked(_ sender: AnyObject) {
        //get a reference to the view controller for the popover
        let popController = UIStoryboard(name: "Personenakte", bundle: nil).instantiateViewController(withIdentifier: "popoverId")

        //set the presentation style
        popController.modalPresentationStyle = UIModalPresentationStyle.popover

        //set up the popover presentation controller
        popController.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.up
        popController.popoverPresentationController?.delegate = self
        popController.popoverPresentationController?.sourceView = sender as! UIView //button
        popController.popoverPresentationController?.sourceRect = sender.bounds

        //present the popover
        self.present(popController, animated: true, completion: nil)
    }

    //UIPopoverPresentationControllerDelegate method
    func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
        //Force popover style
        return UIModalPresentationStyle.none
    }
}

Dieser arbeitet auf dem iPad, aber ein iPhone, das popup bringt die ganze iPhone-Bildschirm. Ich will einfach nur ein kleines Fenster mit einem Pfeil. Ich habe mehrere tutorials, aber keine für mich gearbeitet.

Kommentar zu dem Problem - Öffnen
soweit ich weiß, ist, dass das beabsichtigte Verhalten von apple, es gibt keine popups auf dem iphone Kommentarautor: Fonix
Ihr code es ist für mich arbeiten.... aber Ihre Delegierten es ist auch nicht korrekt Kommentarautor: TonyMkenu

InformationsquelleAutor der Frage ReasyEasyPeasy | 2016-10-11

Schreibe einen Kommentar