没什么好解释的了吧,直接代码了,有需要的可以参考,Demo地址下载的是纯oc写的,本博客内容为swift创建
下载地址:http://download.csdn.net/download/sinat_28585351/10229670
github:https://github.com/Raymon-lau/sliderProgressDemo.git
封装刻度尺
.h
@interface RMScrollView : UIScrollView
- (void)createScorllWithMinValue:(int)min
maxValue:(int)max
intervalValue:(int)intervalValue;
@end
.m
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
@implementation RMScrollView
{
CGFloat _kScrollWidth;
}
- (instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
_kScrollWidth = SCREEN_WIDTH;
self.bounces = NO;
self.showsHorizontalScrollIndicator = NO;
}
return self;
}
- (void)createScorllWithMinValue:(int)min
maxValue:(int)max
intervalValue:(int)intervalValue{
//max为最大值, inter