美文网首页
2020-09-17 新项目第一天

2020-09-17 新项目第一天

作者: 菲特峰 | 来源:发表于2020-09-19 09:30 被阅读0次

首页设计初稿如图,暂时没有切图自己先搭建一个框架,项目使用swift开发

image.png

界面分析

  • 搭建TabBar使用第三方框架ESTabbarController
    如果我们不开发iPadOS多窗口APP,SceneDelegate窗口管理我们可以不需要直接删掉就好了删除info.plist文件中的选项


    image.png
      func setupTabBarStyle(delegate: UITabBarControllerDelegate?) -> ESTabBarController {
          let tabBarController = ESTabBarController()
          tabBarController.delegate = delegate
          tabBarController.title = "Irregularity"
          tabBarController.tabBar.shadowImage = UIImage(named: "TabBar_card")
          
          let home = HomeViewController()
          let train = TrainingViewController()
          let message = MessageViewController()
          let mine = MineViewController()
          
          
          home.tabBarItem = ESTabBarItem.init(LFNormalTabbarView(), title: "首页", image: UIImage(named: "home_icon"), selectedImage: UIImage(named: "home_icon_Selection"))
          train.tabBarItem = ESTabBarItem.init(LFNormalTabbarView(), title: "培训", image: UIImage(named: "news_icon"), selectedImage: UIImage(named: "news_icon_Selection"))
          message.tabBarItem = ESTabBarItem.init(LFNormalTabbarView(), title: "消息", image: UIImage(named: "msg_icon"), selectedImage: UIImage(named: "msg_icon_Selection"))
          mine.tabBarItem = ESTabBarItem.init(LFNormalTabbarView(), title: "我的", image: UIImage(named: "mine_icon"), selectedImage: UIImage(named: "mine_icon_Selection"))
          let homeNav = LFNavigationController.init(rootViewController: home)
          let trainNav = LFNavigationController.init(rootViewController: train)
          let messageNav = LFNavigationController.init(rootViewController: message)
          let mineNav = LFNavigationController.init(rootViewController: mine)
          home.title = "首页"
          train.title = "培训"
          message.title = "消息"
          mine.title = "我的"
          
          tabBarController.viewControllers = [homeNav, trainNav, messageNav, mineNav]
         
          return tabBarController
      }
    
    
  • 界面部分
    自定义下拉选择框 https://www.jianshu.com/p/da2acd523305
    自定义搜索框 https://www.jianshu.com/p/c05d8a8a93b1
    自定义格子视图 https://www.jianshu.com/p/20fb682ed680
    自定义瀑布流布局https://www.jianshu.com/p/a6eb24b87124

  • 图片轮播依然使用SDCycleScrollView

实现瀑布流布局

    //设置瀑布流
    func setupCollectionView() {
        let waterFallLayout =  LFWaterFallLayout.init()
        waterFallLayout.delegate = self
        let collectionView = UICollectionView.init(frame:CGRect.init(x: 0, y: 0, width: kScreenWidth, height: kScreenHeigth-tabBarHeight-navigationBarHeight-250), collectionViewLayout: waterFallLayout)
        
        collectionView.dataSource = self
        collectionView.backgroundColor = AppColor.white
        collectionView.register(nibWithCellClass: PXSWaterFallCell.self)
        
        self.tableView.tableFooterView = collectionView
        
    }

实现代理方法

extension HomeViewController {

        func numberOfSections(in collectionView: UICollectionView) -> Int {
            return 1
        }
        
        func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
            return 10
        }
        
        func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
            let cell =  collectionView.dequeueReusableCell(withClass: PXSWaterFallCell.self, for: indexPath)
            return cell
        }
    
    
        func heightForItemAtIndexPath(indexPath: Int, itemWidth: CGFloat, waterFallLayout: LFWaterFallLayout) -> CGFloat {
            let y = arc4random() % UInt32(200) + UInt32(60)

            return CGFloat(y)

        }
        func rowMarginInWaterFallLayout(waterFallLayout: LFWaterFallLayout) -> CGFloat {
            return 20
        }
        
        func columnCountInWaterFallLayout(waterFallLayout: LFWaterFallLayout) -> Int {
            return 2
        }
        

}

image.png

到这首页差不多界面搭建完毕了

相关文章

  • 2020-09-17 新项目第一天

    首页设计初稿如图,暂时没有切图自己先搭建一个框架,项目使用swift开发 界面分析 搭建TabBar使用第三方框架...

  • 开发过程中一次蛋疼的经历

    最近新公司接手新项目,信心满满的去了,没想到第一天就来了个滑铁卢。。。新项目某个界面需要展示新闻内容,这个新闻内容...

  • python数据类型之元组、布尔、NONE

    基本数据类型之元组,布尔,None 2020-09-17 Reads 5 元组类型(tuple) 元组与列表类似,...

  • 又活了一天

    新项目第一天 任务:元数据的分类:t_metadata_category 元数据分类(今日任务)t_metada...

  • 情系遗乡-02. 河沿

    写于2015-11-4 21:38 修改2020-09-17 22:53 记得,回家的过程是艰苦的,只是少却了许多...

  • 2020-09-17日面试

    很久没参加过面试了,2020-09-17参见了一次面试,感觉很不好,现在总结下。。 问题一:介绍下自己 我突...

  • 2020-09-18

    2020-09-17 姓名 :曹静杰 企业名称 : 辽宁辽阳丛迪服装有限公司 组别 388期 反省1组 志工529...

  • 2020-09-18

    2020-09-17 姓名 :曹静杰 企业名称 : 辽宁辽阳丛迪服装有限公司 组别 388期 反省1组 志工529...

  • 臭儿、臭儿,卖狗肉

    我怎么如此幸运-重生20-戴红霞(2020-09-17) 我怎么如此幸运-臭儿、臭儿,卖狗肉 1.我怎么如此幸运感...

  • 弘道积德老子文化国际论坛:培养教育真人成为圣人、善辅自然的弘道积

    培养教育真人成为圣人、善辅自然的弘道积德平台弘道积德老子文化奖2020-09-17 21:32培养教育真人成为圣人...

网友评论

      本文标题:2020-09-17 新项目第一天

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