Próbuję zrobić wyskakujące okienko, które zostanie wyświetlone po naciśnięciu przycisku. Próbowałem postępować zgodnie z instrukcjami, które znalazłem w google, ale mój popowy widok przedstawia się na pełnym ekranie, a jego tło jest czarne. Oto mój kod: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)
}
}
Co I'am robi źle?