DVSwitch iOS 切换视图

程序名称:DVSwitch

授权协议: MIT

操作系统: iOS

开发语言: Objective-C

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

相关编程语言

Acapela TTS 是一个为 iPhone 和 iPad 开发的 TTS 引...
二维码(QR Code)扫描静态库,扫描效率较高。
RegexKitLite 是一个轻量级的 Objective-C 的正则表...
一款基于ASIHttpReques开源的仿迅雷多线程断点续传功...
实现动态检测网络(wifi)状况,不需要用户手动刷新...
使用iphoneSDK官方NSXMLParserDelegate做的简单xml解...