如何创建评级点

How to create Rating Dots

我想实现这样的目标:

总共应该有 5 个圆点,但黑色圆点可以是可变的。 有没有 Github 项目之类的? 我尝试使用 UIProgressbar 的子类,但效果并不好!

cell.ratingDot.numberOfPages = 5;
cell.ratingDot.alignment = GTControlAlignmentLeft;
cell.ratingDot.pageIndicatorTintColor = [UIColor whiteColor];
//Its not possible as you can see to set more than one dot to the  ratingDot value
cell.ratingDot.currentPageIndicatorTintColor = [UIColor blackColor];

A quick search on GitHub with rating ios as query 给我这个:

Tips: when browsing GitHub, type one or two words max. describing what you need, followed by the official Whosebug tag (eg. ios,java, etc).

怎么样...

一个UIView,有5个UIImageView个子view,每个imageView有一个常规和高亮的图片:

- initWithImage:highlightedImage:

然后根据评分设置每个imageView的highlighted 属性。

与其仅仅引入一些第 3 方代码,还不如将其作为学习的机会!