Skip to content

mohsinalimat/FWSegmentedControl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IOS之分段控制器 -- OC/Swift通用

支持pod导入:

pod 'FWSegmentedControl'

简单使用:

/// 类初始化方法
///
/// - Parameters:
/// - scType: segment类型
/// - sectionTitleArray: 标题,可传nil,后续再设置
/// - sectionImageArray: 图片,可传nil,后续再设置
/// - sectionSelectedImageArray: 选中图片,可传nil,后续再设置
/// - frame: frame
@objc open class func segmentedWith(scType: SCType, scWidthStyle: SCWidthStyle, sectionTitleArray: [String]?, sectionImageArray: [UIImage]?, sectionSelectedImageArray: [UIImage]?, frame: CGRect) -> FWSegmentedControl

OC:

FWSegmentedControl *segmentedControl = [FWSegmentedControl segmentedWithScType:SCTypeText scWidthStyle:SCWidthStyleDynamicFixedSuper sectionTitleArray:@[@"关注", @"游戏", @"附近"] sectionImageArray:nil sectionSelectedImageArray:nil frame:CGRectMake(0, 40, self.view.frame.size.width, 50)];

Swift:

let segmentedControl = FWSegmentedControl.segmentedWith(scType: SCType.text, scWidthStyle: SCWidthStyle.fixed, sectionTitleArray: ["关注", "游戏", "附近"], sectionImageArray: nil, sectionSelectedImageArray: nil, frame: CGRect(x: 0, y: 40, width: Int(UIScreen.main.bounds.width), height: 50))

效果:

结尾语:

使用过程中有任何问题或者新的需求都可以issues我哦,谢谢!

About

choiceyou/FWSegmentedControl

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 69.8%
  • Objective-C 24.9%
  • Ruby 5.2%
  • C 0.1%