IOS development-View Controller paging and iospaging

Source: Internet
Author: User

IOS development-View Controller paging and iospaging

When learning the Open Source Chinese ios source code, we found that the method for implementing view controllers paging is as follows:

1. Define a view controller of the container class, which is similar to UIPageViewController. The vc consists of two parts:

A title view is used to indicate what the current content is, and the user can click to switch the content

B. A table view controller (added through addChildViewController and added the view of table view controller to the view of the container) is used to display the content, that is, paging is implemented in response to user gestures.

Second, set tableview transform, rotate tableview 90 degrees, set pagingEnable to yes (UIScrollView attribute), and set the cell height to the screen width in the table view delegate method, in this way, the table view can be converted into a view that can be paging.

So how to add the view controllers content to the table view? First, add all view controllers to table view controller, and then add the view of view controller to the content view of table view cell, in this way, the content in table view cell is the content of view controllers.

This implementation mainly involves three roles:

1. view controller of the container class, mainly used to coordinate title view and table view controller

2. table view controller, used to implement paging in the horizontal direction of content

3. view controllers, used to provide content

 

Because UIKit itself provides paging view controller, why not use it directly?

After testing, you can use paging view controller to implement the above basic functions.

Code: https://github.com/beddup/BeddupPageViewControllerDemo

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.