FFCategoryHUD 0.3.0

FFCategoryHUD 0.3.0

测试已测试
语言语言 SwiftSwift
许可 MIT
发布最后发布2019年6月
SPM支持 SPM

CoderFeiSu 维护。



  • sf290798

FFCategoryHUD

  • 其中有两个框架,一个类似于网易新闻顶部的滚动条,一个是图片键盘
  • 简单易用

怎样使用

  • CocoaPods 使用 pod 'FFCategoryHUD'
  • 手动将 FFCategoryHUD 文件夹拖入项目中
  • 网易新闻顶部示例代码1
	
    let frame = CGRect(x: 0, y: 64, width: 375, height: view.bounds.height - 64)
    let titles = ["哈哈df","哈哈哈sdfas","哈哈哈333","","134124哈哈哈","说就撒了开发商"]
    var barStyle = FFSegmentBarStyle()
    barStyle.isShowBottomLine = true
    barStyle.isNeedScale = true
    barStyle.bottomLineColor = UIColor.red
    var childVCs = [UIViewController]()
    for _ in 0..<titles.count {
        let vc = UIViewController()
        vc.view.backgroundColor = UIColor.random
        childVCs.append(vc)
    }
    let segmentContainer = FFSegmentContainer.init(frame: frame, barTitles: titles, barStyle: barStyle, childVCs: childVCs, parentVC: self)
    view.addSubview(segmentContainer)
网易新闻顶部效果图

  • 图片键盘示例代码2
        import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
 
        automaticallyAdjustsScrollViewInsets = false

        
        let frame = CGRect(x: 0, y: view.bounds.height - 216, width: view.bounds.width, height: 216)
        let titles = ["低级", "初级", "中级", "高级"]
        var  barStyle = FFKeyboardBarStyle()
        barStyle.isShowBottomLine = true
        barStyle.bottomLineColor = UIColor.red
        let layout = FFCategoryKeyboardLayout()
        let keyboardContainer = FFKeyboardContainer.init(frame: frame, barTitles: titles, barStyle: barStyle, layout: layout)
        keyboardContainer.delegate = self
        keyboardContainer.dataSource = self
        keyboardContainer.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "abc")
        view.addSubview(keyboardContainer)
        
    }
    
}

extension ViewController: FFKeyboardContainerDataSource, FFKeyboardContainerDelegate {

    func numberOfSections(in keyboardContainer: FFKeyboardContainer) -> Int {
        return 4
    }
    
    func keyboardContainer(_ keyboardContainer: FFKeyboardContainer, numberOfItemsInSection section: Int) -> Int {
        if (section == 0) {
        return 1
        } else if (section == 1) {
          return 50
        } else if (section == 2) {
            return 22
        } else {
          return 10
        }
    }
    
    func keyboardContainer(_ keyboardContainer: FFKeyboardContainer, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = keyboardContainer.dequeueReusableCell(withReuseIdentifier: "abc", for: indexPath)
        cell.backgroundColor = UIColor.random
        return cell
    }
    
}

图片键盘效果图

支持版本

iOS8及以上