DrawCircleFrame 1.3.1

DrawCircleFrame 1.3.1

测试已测试
语言语言 Obj-CObjective C
许可证 Apache 2
发布上次发布2015年9月

Natalia Osiecka 维护。



  • natalia.osiecka

DrawCircleFrame

这是一个小型项目,允许通过绘制围绕它的圆形来突出显示给定的选项。

可定制性

您可以设置:

  • 线条颜色
[_button.dcfView setLineColor:[UIColor blueColor]];
  • 动画持续时间
[_button.dcfView setAnimationDuration:4.f];
  • 绘制动画或非动画
[_button.dcfView drawBezierAnimated:YES];
  • 绘制完成后执行的回调
__weak __typeof(_button)weakButton = _button;
[_button.dcfView setCompletionBlock:^{
    [weakButton.dcfView setHidden:YES];
}];
  • 线条宽度
[_button.dcfView setLineWidth:5.f];
  • 起始位置(支持所有角落)
[_button.dcfView setStartPosition:DCFStartPositionBottomLeft];
  • 贝塞尔近似值我使用的 UIBezierPath 需要起止点和 2 个中间点。经过一些计算,看来我支持的两个值(2.25f)在大多数情况下工作得很好,绘制得非常精确。但是,如果您希望绘制更大或更小的效果,请自行调整此值。您可能还需要更改边距。
[_button.dcfView setBezierApproximation:2.5f];
  • 边距(绘制描述所需的额外空间)
[_button.dcfView setMarginValue:40.f];
  • 背景颜色、隐藏、alpha 以及与视图参数相关的一切
[_button.dcfView setBackgroundColor:[UIColor colorWithWhite:0.f alpha:0.3f]];

DrawCircleFrame img1

安装

子模块

在您项目的 git 文件夹中输入:

git submodule init
git submodule add --copy link to the repo--
git submodule update

从 DrawCircleFrame/DrawCircleFrame 文件夹复制所有文件。

仅下载并附加

这非常不建议,因为您将无法看到代码更新。请克隆或下载源代码,然后从 DrawCircleFrame/DrawCircleFrame 文件夹复制所有文件。

实现

克隆并查看演示以获取更多关于实现的示例。您可以通过 Storyboard 或使用代码添加视图。

// in your view.h download the library
#import <DrawCircleFrame/NODCFButton.h>
#import <NOCategories/NSString+NOCSize.h>
// then add a property
@property (nonatomic) NODCFButton *button;

// alloc & init the view or setup this via storyboard
- (id)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        _button = [[NODCFButton alloc] initWithFrame:CGRectMake(0, 0, 200, 30)];
        [self addSubview:_button];
    }
    return self;
}

// in your controller you can change outlook of the control
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];

    // setup all properties eg
    [_dcfExampleView.button.dcfView setLineColor:[UIColor greenColor]];
    // drawing happens after calling this method
    [_dcfExampleView.button.dcfView drawBezierAnimated:YES];
}

变更日志

  • 1.3.0 通用代码重构。添加了类前缀。删除了前缀文件。
  • 1.2 修复了 podspec 中的错误依赖。
  • 1.1 添加了 NOCategories 子规范。
  • 1.0 添加了基本类。添加了演示。

作者

Natalia Osiecka,[email protected]

许可证

Apache 2.0 许可。有关更多信息,请参阅 LICENSE 文件。

要求

需要 Xcode 5,针对 iOS 6.0 或更高版本