What I did:
- I am using scrollview to view some
UIView
(s), with paging enabled. - In last page in subview of scrollView I added a button.
- I also wrote a function which is in subclass of
UIView
,which is invoked when we press that button. - I want to view storyboard when I press that button.
hope this will help
the way i perceive your question is ->Rightnow your inside you are in
UIView
class and inside it there is a button by clicking it you want to push or present a ViewController and offcourse from inside your UIView class you cant push or present your view Controller. Soyou can do one simple thing first inside action method make a ref(forward declaration) or you can make a whole new object of your ViewController class in which your UIView is present right now , then call a function(which exist in your ViewController) like
//function inside your uiview calss
// function inside your view controller
Take a look at this
Firstly you need to set a storyboard Id to your ViewController, namely "mainVC". Then you could pus/present it using below code :-
Also in case if you want your another storyboard to be initiated then below,
You need to implement protocol method for custom UIView class.
For example;
And the .m file you can call buttonTapped delegate method.
For proper work;
Edit
I will try to illustrate very simple usage of protocols, hope it will help you.
try like this