NORosettaView 0.1.0

NORosettaView 0.1.0

测试已测试
语言语言 Obj-CObjective C
许可证 Apache 2
发布最后一次发布2015年8月

Natalia Osiecka 维护。



  • 作者
  • natalia.osiecka

基于圆弧和控制元素的选择数量(类似于比萨饼)。

示例

NORosettaView NORosettaView

自定义外观

  • 设置开始绘制的角度(例如从顶部开始绘制),
  • 设置绘制的总角度(例如 180 度,因此是半圆),
  • 设置要显示的弧线数量,
  • 更改弧线之间的边缘大小,
  • 自定义选中和不选中弧线的背景颜色,
  • 更改绘制的厚度(从圆心绘制完整弧线到圆的中间或只是边框),
  • 在每个弧线上添加文本(圆形标签),
  • 自定义细节如阴影,
  • 对每个叶子点按做出反应(利用 blocks 优势)。

NORosettaView img1 NORosettaView img1 NORosettaView img1

实现

请参考示例以获取更深入的示例或查看源代码。

NORVView

  • actionBlock - 允许对用户交互(点击)做出反应。
[rosettaView setActionBlock:^(NORVView *view, NSUInteger selectedIndex) {
    [view setSelectedIndex:selectedIndex];
    [weakSelf updateView:view withSelectedIndex:selectedIndex];
}];
  • selectedIndex - 确定选中圆中弧线的索引。
[rosettaView setSelectedIndex:selectedIndex];
  • leaves - 确定弧线的数量、颜色、文本等。有关更多信息,请参阅 NORVLeaf 文档
[rosettaView setLeaves:@[leaf1, leaf2, leaf3]];
  • startAngle - 确定开始绘制弧线的位置。默认 180 度,即左侧中间。
 [rosettaView setStartAngle:45.f];
  • totalAngle - 确定所有弧线应绘制的角度。例如,180 度会使半圆填充弧线,其余为空。
 [rosettaView setTotalAngle:90.f];
  • marginAngle - 确定圆的外侧弧线之间的角度。
 [rosettaView setMarginAngle:5.f];
  • thickness - 确定应填充颜色的宽度。1 产生边界,半径产生使用颜色的完整填充。
[rosettaView setThickness:70.f];
  • shadowWidth - 确定周围元素的阴影宽度。
 [rosettaView setShadowWidth:5];
  • shadowColor - 确定周围元素的阴影颜色。
 [rosettaView setShadowColor:[UIColor blackColor]];

NORVLeaf

  • rosettaLeafWithColor:selectedColor:circleTextView: - 带基本设置的叶子对象的便利初始化器。
[NORVLeaf rosettaLeafWithColor:[UIColor grayColor]
                                         selectedColor:[UIColor blackColor]
                                        circleTextView:[NORVCircleTextView rosettaCircleText:@"Button" withTextAttributes:nil]];
  • color - 确定未选中元素的颜色。
 [leaf setColor:[UIColor blackColor]];
  • selectedColor - 确定选中元素的颜色。
 [leaf setSelectedColor:[UIColor blackColor]];
  • circleTextView - 确定具有圆角文本的标签。
 [leaf.circleTextView setTextAttributes:(i == selectedIndex) ? selectedTextAttributes : textAttributes];

NORVCircleTextView

继承自 XMCircleTypeView(归功于: XMCircleType)。用于在叶子显示文本。

  • rosettaCircleText:withTextAttributes: - 带属性的文本的便利初始化器。
[NORVCircleTextView rosettaCircleText:NSLocalizedString(@"Quite Long Button", nil)
                                                                       withTextAttributes:nil];

安装

子模块

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

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

将NORosettaView/RosettaView文件夹中的所有文件复制下来。

仅下载 & 附加

这强烈不建议,因为您将无法查看代码更新。克隆或下载源代码,将NOCategories文件夹中的所有文件复制下来。

变更日志

  • 0.1 添加基本项目,配置样式,添加第一个cocoapod。

作者

Natalia Osiecka,[email protected]

许可证

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

要求

需要Xcode 6,目标iOS 6.0或更高版本。