测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可证 | Apache 2 |
发布日期上次发布 | 2015年7月 |
由 Natalia Osiecka 维护。
圆形控件,以选择指定数量的值。
有三个种类的对象
[_circleSelector setNumberOfDots:4];
[_circleSelector setDotRadius:50.f];
[_circleSelector setLineWidth::2.f];
[_circleSelector setLineColor:[UIColor redColor]];
[_circleSelector setFillColor:[UIColor blueColor]];
[dot setLineWidth:2.f];
[dot setLineColor:[UIColor redColor]];
[dot setFillColor:[UIColor greenColor]];
[dot.textLabel setText@"Hello!"];
[dot.imageView setImage:[UIImage imageNamed:@"girl"]];
[dot setAngle:90.f];
[dot setMinAngle:0.f];
[dot setMaxAngle:360.f];
[dot shouldDrawConnectionBehind:YES];
[connection setConnectionColor:[UIColor redColor]];
[connection setLineWidth:3.f];
[dot setLineWidth:2.f];
在您的项目的 git 文件夹中输入
git submodule init
git submodule add --copy link to the repo--
git submodule update
从 NOSELCircleSelector 文件夹中复制所有文件。
强烈不推荐这样做,因为您将无法看到代码更新。请克隆或下载源代码,复制NOCircleSelector文件夹中的所有文件。
克隆并查看示例以了解更多实现示例。您可以通过Storyboard或使用代码添加视图。
// in your view.h download the library
#import <NOCircleSelector/NOSELCircleSelector.h>
// add a property
@property (nonatomic) NOSELCircleSelector *circleSelector;
// alloc & init the view or setup this via storyboard (eg in view's initWithFrame:)
_circleSelector = [[NOSELCircleSelector alloc] initWithFrame:frame];
[_circleSelector setBackgroundColor:[UIColor clearColor]];
[self addSubview:_circleSelector];
// update the frame (eg in view's layoutSubviews) or use constraints
[_circleSelector setFrame:self.bounds];
// in your controller setup basic view
- (void)viewDidLoad {
[super viewDidLoad];
// if you need you can subscribe to delegate to handle events
[_aView.circleSelector setDelegate:self];
[_aView.circleSelector setTag:ExampleCircleSelectorBig];
[_aView.circleSelector setNumberOfDots:3];
[_aView.circleSelector setDotRadius:30.f];
}
// and handle whichever delegate you need
- (void)circleSelector:(NOSELCircleSelector *)circleSelector changedDots:(NSArray *)dots {
NOSELCircleDot *dot1 = [dots objectAtIndex:0];
[dot1 setUserInteractionEnabled:NO];
[dot1 setAngle:270.f];
[dot1.imageView setImage:[UIImage imageNamed:@"girl"]];
}
- (void)circleSelector:(NOSELCircleSelector *)circleSelector changedDotConnections:(NSArray *)dotConnections {
for (NOSELCircleDotConnection *dotConnection in dotConnections) {
[dotConnection setConnectionColor:[UIColor blueColor]];
[dotConnection setLineWidth:2.f];
}
}
- (void)circleSelector:(NOSELCircleSelector *)circleSelector updatedDot:(NOSELCircleDot *)dot {
[dot.textLabel setText:[NSString stringWithFormat:@"%d", (int)dot.angle]];
}
- (void)circleSelector:(NOSELCircleSelector *)circleSelector beganUpdatingDotPosition:(NOSELCircleDot *)dot {
[_view.valueLabel setHidden:NO];
}
- (void)circleSelector:(NOSELCircleSelector *)circleSelector endedUpdatingDotPosition:(NOSELCircleDot *)dot {
[_view.valueLabel setHidden:YES];
}
- (Class)circleSelectorRequestsNOCircleDotClass:(NOSELCircleSelector *)circleSelector {
return [ExampleCircleDot class];
}
包含2个示例。第一个(左边的)是一个<20行的简单配置。第二个示例处理最小和最大值、线颜色、宽度和等。
Natalia Osiecka,[email protected]
Apache 2.0许可证下提供。有关更多信息,请参阅LICENSE文件。
需要Xcode 6,针对iOS 5.1.1或更高版本。