AMRatingControl 1.3.0

AMRatingControl 1.3.0

测试已测试
Lang语言 Obj-CObjective C
许可协议 MIT
发行最新发行2014年12月

无人认领 维护。



  • amseddi
这是从jasarien/JSFavStarControl复制的。

AMRatingControl是一个UI控件,它类似于在iPod应用程序中看到的“星形评分”控件。

AMRatingControl允许您从0开始选择任何数量的星。

您可以使用默认的星形符号,并自定义颜色或指定自定义图像。

如何开始

- 使用CocoaPods

pod 'AMRatingControl'

- 不使用CocoaPods

AMRatingControl.hAMRatingControl.m添加到您的项目中。

示例用法

#include "AMRatingControl.h"

// Create a simple instance, initing with :
// - a CGPoint (the position in your view from which it will be drawn)
// - and max rating
AMRatingControl *simpleRatingControl = [[AMRatingControl alloc] initWithLocation:(CGPoint)location
                                                                    andMaxRating:(NSInteger)maxRating];

// Customize the current rating if needed
[ratingControl setRating:(NSInteger)rating];

// Define block to handle events
simpleRatingControl.editingChangedBlock = ^(NSUInteger rating)
{
    [label setText:[NSString stringWithFormat:@"%d", rating]];
};

simpleRatingControl.editingDidEndBlock = ^(NSUInteger rating)
{
    [endLabel setText:[NSString stringWithFormat:@"%d", rating]];
};

// Create an instance with images, initing with :
// - a CGPoint (the position in your view from which it will be drawn)
// - a custom empty image and solid image if you wish (pass nil if you want to use the default).
// - and max rating
AMRatingControl *imagesRatingControl = [[AMRatingControl alloc] initWithLocation:(CGPoint)location
                                                                      emptyImage:(UIImage *)emptyImageOrNil
                                                                      solidImage:(UIImage *)solidImageOrNil
                                                                    andMaxRating:(NSInteger)maxRating];

// Create an instance with custom colors, initing with :
// - a CGPoint (the position in your view from which it will be drawn)
// - a custom empty image and solid image if you wish (pass nil if you want to use the default).
// - and max rating
AMRatingControl *coloredRatingControl = [[AMRatingControl alloc] initWithLocation:(CGPoint)location
                                                                       emptyColor:(UIColor *)emptyColorOrNi
                                                                       solidColor:(UIColor *)solidColorOrNi
                                                                     andMaxRating:(NSInteger)maxRating];  

// Add the control(s) as subview of your view
[view addSubview:simpleRatingControl];
[view addSubview:imagesRatingControl];
[view addSubview:coloredRatingControl];

Example ScreenShot

ARC

AMRatingControl使用ARC。

许可协议

AMRatingControl可在MIT许可协议下使用。有关更多信息,请参阅LICENSE文件。