一、方法方式处理@H_404_1@
@IBAction func btn1(_ sender: UIbutton) { let vc = customedPageController() vc.hIDesBottombarWhenPushed = true; self.navigationItem.backbarbuttonItem = UIbarbuttonItem.init() self.navigationController?.pushVIEwController(vc,animated: true } // MARK: - An example of `PageController` fileprivate func customedPageController() -> WMPageController { let vcclasses:[AnyClass] = [AllOrderVC().classForCoder,WaitPaymentOrderVC().classForCoder,WaitDeliveryOrderVC().classForCoder,WaitReceiveOrderVC().classForCoder,WaitEvaluateVC().classForCoder] let Titles = ["全部订单","待付款","待发货","待收货","待评价"] let pageVC = WMPageController(vIEwControllerClasses: vcclasses,andTheirTitles: Titles)// pageVC.tabbarController?.tabbar.isHIDden = true pageVC.title="我的订单" pageVC.itemsWIDths = [70,50,50] //每个 MenuItem 的宽度‘ pageVC.menuVIEw?.frame = CGRect.init(x: 0,y: 0,wIDth: DeviceMaxWIDth,height: 44) //导航栏高度 pageVC.menuVIEw?.backgroundcolor = UIcolor.red //导航栏颜色 pageVC.postNotification = true // pageVC.bounces = true pageVC.TitleSizeSelected=13 //选中时的标题尺寸 pageVC.TitleSizenormal=14 //非选中时的标题尺寸 pageVC.menuVIEwStyle = .line //Menu vIEw 的样式,默认为无下划线 pageVC.TitlecolorSelected=UIcolor.red //标题选中时的颜色,颜色是可动画的. pageVC.Titlecolornormal=UIcolor.black //标题非选择时的颜色,颜色是可动画的 pageVC.scrollVIEw?.height = 100 return pageVC }
二 自定义 vc@H_404_1@
//// CustomOrderVC.swift// ALSPetsMail//// Created by 冰泪 on 2017/12/13.// copyright © 2017年 冰泪. All rights reserved.//import UIKitimport WMPageControllerclass CustomOrderVC: WMPageController { let vcclasses:[AnyClass] = [AllOrderVC().classForCoder,WaitEvaluateVC().classForCoder] let Titles1:[String] = ["全部订单","待评价"] private func createUI() { self.vIEwControllerClasses = vcclasses self.Titles = Titles1 self.title="我的订单" self.itemsWIDths = [80,50] //每个 MenuItem 的宽度‘// self.menuVIEw?.backgroundcolor = UIcolor.red //导航栏颜色 self.postNotification = true // self.bounces = true self.TitleSizeSelected=13 //选中时的标题尺寸 self.TitleSizenormal=13 //非选中时的标题尺寸 self.menuVIEwStyle = .line //Menu vIEw 的样式,默认为无下划线 self.TitlecolorSelected=UIcolor.red //标题选中时的颜色,颜色是可动画的. self.Titlecolornormal=UIcolor.black //标题非选择时的颜色,颜色是可动画的 } overrIDe func vIEwDIDLoad() { super.vIEwDIDLoad() createUI() } overrIDe func dIDReceiveMemoryWarning() { super.dIDReceiveMemoryWarning() // dispose of any resources that can be recreated. } }extension CustomOrderVC { overrIDe func numbersOfChildControllers(in pageController: WMPageController) -> Int { return Titles1.count } overrIDe func pageController(_ pageController: WMPageController,vIEwControllerAt index: Int) -> UIVIEwController { let vc : UIVIEwController! switch index { case 0: vc = AllOrderVC() case 1: vc = WaitPaymentOrderVC() case 2: vc = WaitDeliveryOrderVC() case 3: vc = WaitReceiveOrderVC() default: vc = WaitEvaluateVC() } return vc } overrIDe func pageController(_ pageController: WMPageController,TitleAt index: Int) -> String { return Titles1[index] } overrIDe func pageController(_ pageController: WMPageController,preferredFrameFor menuVIEw: WMMenuVIEw) -> CGRect { let navH:CGfloat! = (self.navigationController?.navigationbar.max_y) return CGRect(x: 0,y: navH,height: 45) } overrIDe func pageController(_ pageController: WMPageController,preferredFrameForContentVIEw contentVIEw: WMScrollVIEw) -> CGRect { let navH:CGfloat! = (self.navigationController?.navigationbar.max_y) return CGRect.init(x: 0,y: navH+45,height: DeviceMaxHeight-navH-45) }}
/// 获取或设置 y public var max_y: CGfloat { get { return frame.origin.y + frame.size.height } set { frame.origin.y = max_y - frame.size.height } }@H_404_1@ 总结
以上是内存溢出为你收集整理的WMPageController Swift 用法全部内容,希望文章能够帮你解决WMPageController Swift 用法所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)