SYSegmentedControl 1.1.7

SYSegmentedControl 1.1.7

测试已测试
Lang语言 Obj-CObjective C
许可证 NOASSERTION
发布最新发布2020年3月

Stanislas Chevallier 维护。



  • Stan Chevallier

SYSegmentedControl

自定义组件,用于在 iOS 和 tvOS 上重现 UISegmentedControl 的功能以及以下功能

  • 取消选择所有项
  • 选择多个项
  • 自定义高度
  • 自定义字体
  • 自定义颜色(在 tvOS 上)

可能并非所有都完美,如果您发现错误或需要其他功能,请随意发送 pull request!

@protocol SYSegmentedControlDelegate <NSObject>

- (void)segmentedControl:(SYSegmentedControl *)segmentedControl
  changedSelectedIndexes:(NSIndexSet *)selectedIndexes;

@end

IB_DESIGNABLE
@interface SYSegmentedControl : UIView

@property (nonatomic, weak) IBOutlet id<SYSegmentedControlDelegate> delegate;
@property (nonatomic, strong)               NSArray <NSString *> *titles;
@property (nonatomic)                       NSArray <NSString *> *selectedTitles;
@property (nonatomic)         IBInspectable NSString        *titlesAsString;
@property (nonatomic)         IBInspectable NSString        *selectedTitlesAsString;
@property (nonatomic, strong) IBInspectable UIFont          *font;
@property (nonatomic, strong) IBInspectable NSIndexSet      *selectedIndexes;
@property (nonatomic, assign) IBInspectable CGFloat         height;
@property (nonatomic, assign) IBInspectable CGFloat         lineWidth;
@property (nonatomic, assign) IBInspectable CGFloat         marginBetweenItems;
@property (nonatomic, assign) IBInspectable UIEdgeInsets    itemsInsets;
@property (nonatomic, assign) IBInspectable BOOL            equalWidths;
@property (nonatomic, assign) IBInspectable BOOL            allowMultipleSelection;
@property (nonatomic, assign) IBInspectable BOOL            allowNoSelection;

#if TARGET_OS_TV
@property (nonatomic, strong) IBInspectable UIColor *textColor;
@property (nonatomic, strong) IBInspectable UIColor *focusedTextColor;
@property (nonatomic, strong) IBInspectable UIColor *focusedBackgroundColor;
@property (nonatomic, strong) IBInspectable UIColor *selectedTextColor;
@property (nonatomic, strong) IBInspectable UIColor *selectedBackgroundColor;
#endif

@end

许可证

再次,您可以对这段代码为所欲为,但如果您喜欢,请发邮件给我表示感谢 ;)