美文网首页
iOS 极简高复滚动式组件 NNTabController

iOS 极简高复滚动式组件 NNTabController

作者: SoaringHeart | 来源:发表于2019-10-15 17:17 被阅读0次

    每一个页面都是一个UIViewController,点击标题底下视图切换,滑动底下视图,标题切换

    NNTabController效果图.gif
    //
    //  PlateNumMainController.swift
    //  SwiftTemplet
    //
    //  Created by Bin Shang on 2019/9/20.
    //  Copyright © 2019 BN. All rights reserved.
    //
    
    import UIKit
    import SwiftExpand
    
    class PlateNumMainController: NNTabController, NNTabControllerDelegate {
        
        override func viewDidLoad() {
            super.viewDidLoad()
            
            view.showItemNum = 4.5;//决定顶部显示元素个数
    
            title = "车场信息"
            // Do any additional setup after loading the view.
            delegate = self;
            viewControllers = [oneVC,
                               twoVC,
                               threeVC,
                               fourVC,
                               fiveVC]
        }
        
        // MARK: -NNTabControllerDelegate
        func tabController(_ tabController: NNTabController, willSelect viewController: UIViewController) {
            DDLog(viewController)
        }
        func tabController(_ tabController: NNTabController, didSelect viewController: UIViewController) {
            DDLog(viewController)
        }
        
        // MARK: -lazy
        lazy var oneVC: PlateNumberController = {
            let VC = PlateNumberController()
            
            return VC;
        }()
        
        lazy var twoVC: PlateNumOriginController = {
            let VC = PlateNumOriginController()
            
            return VC;
        }()
        
        lazy var threeVC: KeyBoardViewController = {
            let VC = KeyBoardViewController()
            
            return VC;
        }()
        
        lazy var fourVC: PickerViewController = {
            let VC = PickerViewController()
            
            return VC;
        }()
        
        lazy var fiveVC: PhotosViewController = {
            let VC = PhotosViewController()
            
            return VC;
        }()
        
    }
    

    github源码

    相关文章

      网友评论

          本文标题:iOS 极简高复滚动式组件 NNTabController

          本文链接:https://www.haomeiwen.com/subject/qtpjuctx.html