DVSwitch 介绍
DVSwitch 是可定制的,基于 UISwitch 和 UISegmentedControl 的控件,使用 Objective-C 编写。
DVSwitch 灵感来源于 UISwitch 和 UISegmentedControl,目标如下:
使用
DVSwitch *switcher = [[DVSwitch alloc] initWithStringsArray:@[@"First", @"Second"]]; switcher.frame = CGRectMake(20, 60, self.view.frame.size.width - 40, 34); [self.view addSubview:switcher]; [switcher setpressedHandler:^(NSUInteger index) { NSLog(@"Did switch to index: %lu", (unsigned long)index); }]; [self.view addSubview:switcher];
可定制属性:
-
UIColor *backgroundColor - color of the controls background
-
UIColor *sliderColor - color of slider
-
UIColor *labelTextColorInsideSlider - color of text when slider hovers over it
-
UIColor *labelTextColorOutsideSlider - color of text when outside of slider
-
UIFont *font - font used in control
-
CGFloat cornerRadius - corner radius of control and corner radius of slider
-
CGFLoat sliderOffset - pixel offset in points between the slider and the edge of control
DVSwitch 官网
https://github.com/Voley/DVSwitch
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。