Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let storyboard = UIStoryboard(name: "Main", bundle: nil)
- let viewController = storyboard.instantiateViewController(withIdentifier: "customer_dashboard_date") as! UITableViewController
- viewController.modalPresentationStyle = UIModalPresentationStyle.popover
- viewController.preferredContentSize = CGSize(width: 500, height: 350)
- let button = UIButton (frame : CGRect (x:100, y:100 ,width:100 , height:40))
- button.backgroundColor = UIColor.red
- button.setTitle("My Button", for:.normal)
- button.setTitleColor(UIColor.yellow, for: .normal)
- //viewController.view.addSubview(button)
- present(viewController, animated: true, completion: nil)
- let popoverPresentationController = viewController.popoverPresentationController
- popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.up
- popoverPresentationController?.popoverLayoutMargins = UIEdgeInsets.init(top: 0, left: 100, bottom: 0, right: 0)
- popoverPresentationController?.sourceView = sender
- popoverPresentationController?.sourceRect = CGRect(x: 70, y: 0, width: sender.frame.size.width, height: sender.frame.size.height)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement