Pop up UIViewController on Click of UIButton in Swift 4 (POP UP Controller)


POP up UIViewController on Click of UIButton.

Some time we need to popup a controller on click of UIButton event not to cover all screen just cover some part of screen so we can show some message or perform some action on controller .

For this we need to follow some steps:

1: Take a Two UIViewController like that:

2: Here is “POP” is UIbutton , connect firstView Controller to another by Model Popover .

a: Select Button

b: go To “Connection Inspector”

c: In Triggered Section – select the action and connect to 2nd controller as “present as PopOver”

3: Now Its time to write the code in 1st viewcontroller.

a: Add the “UIPopoverPresentationControllerDelegate” in 1st UIViewcontroller class.

b: write their delegate method in 1st class.

It will look like as :

Here I have taken in 2nd Viewcontroller UItableview so you can can take any thing depends on your requirement.

You can also set the size of UITableView like that:


I have taken custom width & Height if TableView .

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.


It was a successful collaboration. The Mobikul team provided the client everything they needed in a timely and high-quality manner. They were very professional, reliable, and accessible during the entire process. The client also saw no room for any improvements in the vendor's performance.

Vincenzo Carrano

Vincenzo Carrano

Administrator, Segshop

Talk to Sales


Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home