RateView 1.2

RateView 1.2

测试测试过
Lang语言 Obj-CObjective C
许可证 MIT
发布最新发布2015年5月

Tarun Tyagi维护。



  • 作者
  • Tarun Tyagi

RateView - iOS (Objective-C)

RateView是一个创建包含评分星标的可自定义评分视图的UIView子类。它以百分比填充的方式填写星星。可用于:

  • 显示项目的评分 canRate = NO 或}
  • 实际上为用户提供机会对任何产品或商品进行评分 canRate = YES

需求

  • 至少iOS 6.0。
  • 启用ARC。

安装

  • 想要Pod,只需将以下行添加到您的podfile中-
pod 'RateView'
  • 您可以直接从RateView文件夹中复制源文件。

如何使用

配置RateView就像这样简单

RateView* rv = [RateView rateViewWithRating:3.7f];
[self.view addSubview:rv];

RateView从这里接管。

  • 它使用CoreGraphics上下文绘制带有透明背景的星形形状,并按计算出的适当的百分比填充它们。
  • 请注意,您应该提供一个介于0.05.0之间的rating

属性

RateView附带了一组属性用于根据需要进行自定义:rating

  • rating : 与RateView一起使用的评分(0.0f至5.0f)

  • canRate : 用户是否可以使用评分视图进行评分(权限标志)

  • step : 用户可以评分时的评分步骤(0.0f至1.0f)

  • starNormalColor : 评分星的背景颜色

  • starFillColor : 评分星的填充颜色

  • starBorderColor : 评分星的边框颜色

  • starFillMode : 星形填充模式水平、垂直或轴向

  • starSize : 星形大小(宽=高=大小),以点为单位

  • delegate : 注册以监听评分更改

使用[UIColor colorWithPatternImage:]的优点

Given that UIColor is capable of color patterns handling made from images, 
RateView can be used to take advantage of this feature.

外观

Screenshot1 Screenshot2

示例应用

Demo app includes almost all of the property usages through a pretty basic UITableView example.
You can go through it to see these in action at first.