Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interface Builder: Dismiss Modal View Controller Without Code

Is it possible to dismiss a Modal View Controller (e.g. Page Curl) just in Interface Builder?

My current approach always was to create a new ViewController subclass with an IBAction dismissModalViewController and I was wondering if I could save some space / time doing this step just in IB.

like image 566
DAS Avatar asked Sep 23 '26 15:09

DAS


1 Answers

No you cannot, because the Interface builder is simply a layout file, which doesn't run any code.

However you can create a custom UIButton subclass if you like and set that button to always dismiss the modal view controller when it is clicked. So whenever you need to dismiss a modal view controller, you can add in your IB a UIButton that is set to be a class of your created subclass and it will do the work for you.

like image 123
Lefteris Avatar answered Sep 25 '26 08:09

Lefteris