Skip to content

Instantly share code, notes, and snippets.

@enigmatic7earth
Last active July 26, 2018 10:46
Show Gist options
  • Save enigmatic7earth/fccd9a5df1660f5398daccdda8b37b59 to your computer and use it in GitHub Desktop.
Save enigmatic7earth/fccd9a5df1660f5398daccdda8b37b59 to your computer and use it in GitHub Desktop.
Create popup using storyboards
@IBAction func aboutTapped(_ sender: UIBarButtonItem) {
let storyboard = UIStoryboard.init(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "aboutPopover")
vc.modalPresentationStyle = UIModalPresentationStyle.popover
let popvc = vc.popoverPresentationController
popvc?.delegate = self
popvc?.permittedArrowDirections = UIPopoverArrowDirection.any
popvc?.barButtonItem = sender
vc.preferredContentSize = CGSize.init(width: 300, height: 300)
self.present(vc, animated: true, completion: nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment