Skip to content

Professional Multi controller management Framework based on Swift

Notifications You must be signed in to change notification settings

CharlinFeng/CFPagesVC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

image

中国.成都冯成林原创,请支持原创,谢谢 --- Charlin Feng

CFPagesVC (持续关注信息公告牌

Professional Multi controller management Framework based on Swift




Explain:

Multi controller management based on CFPagesVC,Use CFPagesVC You can easily show your custom controller. Here's another version of the OC that I wrote before. CorePagesView: https://github.com/nsdictionary/CorePagesView.

The difference between these two versions is that CorePagesView is based on OC, the use of Scrollview is complete, while the CFPagesVC is based on Swift, and the clever use of CollectionView.




Function display


#### No NavigationController, no TabbarController ![image](./CFPagesVC/show1.gif)



Has NavigationController, no TabbarController

image



No NavigationController, has TabbarController

image



Has NavigationController, has TabbarController

image



More menu items need to be displayed and not to worry about it.

image



Dynamic calculation of menu length.

image



Code page jump control

image

Use



1.Obtain an instance

  let pagesVC = CFPagesVC.getInstance()



2.Data using Closure transfer model

        var titles: [String] = ["已下单","订单","这个是用户的历史订单","库存信息","Massage","所有的订单信息"]
        
        for i in 0..<titles.count{
            
            let orderVC = OrderListVC(nibName: "OrderListVC", bundle: nil)
            
            orderVC.index = i
            
            let pm = CFPagesVC.PagesDataModel(pageVC: orderVC, desc: titles[i])
            
            pageDataModels.append(pm)
        }
        
        pagesVC.pageDataModels = pageDataModels



3. Custom configuration

The default is fully automatic calculation, if you are willing, you can also configure, such as specifying the width and spacing, specify the spacing between the two sides of Scrollview, etc.

    /**  Custom configuration  */
    let configModel = CFPagesVC.PagesConfigModel(useStaticWidthWithBarViewH: 60, leftInset: 40, rightInset: 80, staticWidth: 100)
    pagesVC.pageConfigModel = configModel

Here are two models for you to choose, one is based on the length of the text automatically calculate the length of the menu text, you can specify additional width. The other one is set wide, you can also add additional width.
This class PagesConfigModel is in the CFPagesVC namespace, and he has these properties you can customize:
>.barViewH --- Height of menu bar.
>.leftInset --- The Scrollview menu's left inset.
>.rightInset --- The Scrollview menu's right inset.
>.useStaticWidth --- Use fixed width.
>.barViewH --- Height of menu bar.
>.staticWidth --- Fixed width value of fixed width.
>.btnExtraWidth --- Extra width of menuBtn.



If you want to configure auto width, use

init(useAutoWidthWithBarViewH barViewH: CGFloat,leftInset: CGFloat,rightInset: CGFloat, btnExtraWidth: CGFloat)

If you want to configure the fixed width, use the

init(useStaticWidthWithBarViewH barViewH: CGFloat,leftInset: CGFloat,rightInset: CGFloat, staticWidth: CGFloat)




Life cycle

By using collectionview,CFPagesVC has a strict logical life cycle in managing your custom controller. Inside custom controller, the process of life cycle is printed in console to show the process of switching .


License

This project is made available under the MIT license. See LICENSE.txt for details.

About

Professional Multi controller management Framework based on Swift

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages