Send data and Change Page on button press using UI

2019-09-01 07:53发布

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条回答
我只想做你的唯一
2楼-- · 2019-09-01 08:09

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.

查看更多
登录 后发表回答