Send data and Change Page on button press using UIPageControl

ε祈祈猫儿з 提交于 2019-12-25 02:43:15

问题


I am using UIPageControl and UIScrollView to move between the views by scrolling.

I have followed this tutorial.

I have a button in the first of the view controllers. I would like to send data to the second view controller and also change the page. I would like to know how it is done.


回答1:


You would need to have all of the view controllers created (born at least the first 2) rather than loading purely on demand (scroll).

Add a property to the first controller which holds a reference to the second controller. Set the reference when the instances are created.

When the button is tapped, use the reference to call a method on the second controller.



来源:https://stackoverflow.com/questions/21125939/send-data-and-change-page-on-button-press-using-uipagecontrol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!