Creating pop up menu in iOS

How to create a pop up menu like in screenshot

You can use UIPopoverPresentationController. I have used it in one of my apps like this,

   PopOverView *controller = [segue destinationViewController];
    UIPopoverPresentationController *popController = [controller popoverPresentationController];
    popController.permittedArrowDirections = UIPopoverArrowDirectionAny;

That’s simply a UIAlertController linked to a UIPopover. Here’s an example of one I use in my app:

@IBAction private func addButtonPressed(_ sender: UIBarButtonItem) {
    let message = NSLocalizedString("Type of Ticket", comment: "Title for the action sheet asking for the type of ticket")
    let alert = UIAlertController(title: nil, message: message, preferredStyle: .actionSheet)
    
    alert.addAction(UIAlertAction(title: "Powerball", style: .default) { [unowned self] _ in
        self.performSegue(withIdentifier: .CreateNewTicket, sender: LottoType.powerball.rawValue)
    })
    
    alert.addAction(UIAlertAction(title: "MegaMillions", style: .default) { [unowned self] _ in
        self.performSegue(withIdentifier: .CreateNewTicket, sender: LottoType.megaMillions.rawValue)
        })
    
    alert.addAction(UIAlertAction(title: "Lucky For Life", style: .default) { [unowned self] _ in
        self.performSegue(withIdentifier: .CreateNewTicket, sender: LottoType.luckyForLife.rawValue)
        })

    alert.popoverPresentationController?.barButtonItem = sender
    
    present(alert, animated: true, completion: nil)
}

Notice the second to last line. If you’re on an iPad, then popoverPresentationController will not be nil, and thus it will appear as a popover. If you’re on an iPhone, then it will be nil, and you’ll just get a normal slide-up alert from the bottom of the device.

Hi,
It’s just simple, I also learned from http://technoitworld.com/tutorial-for-creating-a-pop-up-screen-using-swift-3-ios/. If you didn’t got the right solution after this, please ping me. We will try another method.