Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top