Skip to content

RedPig-Lin/MTTCircularSlider

Repository files navigation

MTTCircularSlider

中文介绍

MTTCircularSlider is a circular slider for iOS

(Dome)

Installation

MTTCircularSlider is available on CocoaPods. Just add the following to your project Podfile:

pod 'MTTCircularSlider'

Usage

See dome Xcode project in /MTTCircularSliderDome

Default Style

MTTCircularSlider* slider = [[MTTCircularSlider alloc] initWithFrame:CGRectMake(100, 100, 150, 150)];
[self.view addSubview:slider];

Image Style

Dome

MTTCircularSlider* slider = [[MTTCircularSlider alloc] initWithFrame:CGRectMake(100, 100, 150, 150)];
slider.sliderStyle = MTTCircularSliderStyleImage;
slider.unselectImage = [UIImage imageNamed:@"unselect.png"];
slider.selectImage = [UIImage imageNamed:@"select.png"];
slider.indicatorImage = [UIImage imageNamed:@"indicator.png"];
[self.view addSubview:slider];

Image material(PSD Source)

unselectImage selectImage indicatorImage

Event

[slider addTarget:self action:@selector(sliderValueChanged:) forControlEvents:UIControlEventValueChanged];
[slider addTarget:self action:@selector(sliderEditingDidEnd:) forControlEvents:UIControlEventEditingDidEnd;

Options

sliderStyle:(MTTCircularSliderStyle)

  • MTTCircularSliderStyleDefault = 1, //Default Style
  • MTTCircularSliderStyleImage = 2, //Customize Image Style
  • MTTCircularSliderStyleNone = 0, //None Style
@property (nonatomic) MTTCircularSliderStyle sliderStyle;//Default:MTTCircularSliderStyleDefault

circulate:(BOOL)

@property (nonatomic, getter=isCirculate) BOOL circulate;//Default:NO

MTTCircularSliderStyleDefault

The parameters are effective when MTTCircularSliderStyleDefault

@property (nonatomic) CGFloat lineWidth; //Default:20
@property (nonatomic, strong) UIColor* selectColor; //Default:#0a68ff
@property (nonatomic, strong) UIColor* unselectColor; //Default:#b5b5b5
@property (nonatomic, strong) UIColor* indicatorColor; //Default:#FFFFFF
@property (nonatomic) CGFloat contextPadding; //Default:10

MTTCircularSliderStyleImage

The parameters are effective when MTTCircularSliderStyleImage

@property (nonatomic, strong) UIImage* selectImage;
@property (nonatomic, strong) UIImage* unselectImage;
@property (nonatomic, strong) UIImage* indicatorImage;

Angle

@property (nonatomic) NSInteger angle; //Default:0
@property (nonatomic) NSInteger maxAngle; //Default:360
@property (nonatomic) NSInteger minAngle; //Default:0

Value

@property (nonatomic) CGFloat value; //Default:0
@property (nonatomic) CGFloat minValue; //Default:0
@property (nonatomic) CGFloat maxValue; //Default:1

License

MIT

About

MTTCircularSlider is a circular slider for iOS

Resources

License

Stars

Watchers

Forks

Packages

No packages published