Ich versuche, ein Popup zu machen, das durch Drücken einer Taste angezeigt wird. Versucht, den Anweisungen zu folgen, die ich in Google fand, aber meine pop Ansicht, die in einem vollen Bildschirm darstellt und sein Hintergrund ist schwarz. Hier ist mein Code:Popup UIViewController
class ViewController: UIViewController, UIPopoverPresentationControllerDelegate {
@IBAction func someButtonPressed(sender: UIButton) {
let storyboard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let popupVC = storyboard.instantiateViewControllerWithIdentifier("hello") as! popupViewController
popupVC.modalPresentationStyle = .Popover
popupVC.preferredContentSize = CGSizeMake(300, 300)
let pVC = popupVC.popoverPresentationController
pVC?.permittedArrowDirections = .Any
pVC?.delegate = self
pVC?.sourceView = sender
pVC?.sourceRect = CGRect(x: 100, y: 100, width: 1, height: 1)
presentViewController(popupVC, animated: true, completion: nil)
}
}
Was Ich bin falsch?