IOS 五星评分控件

程序中须要打分的功能,在网上找了几个,都不是很满意。下面是实现出的效果。能够点击,能够拖动。git

 

使用方法:初始化控件。github

    TQStarRatingView *starRatingView = [[TQStarRatingView alloc] initWithFrame:CGRectMake(0, 300, 50 * 5, 50) numberOfStar:5];
    starRatingView.delegate = self;
    [self.view addSubview:starRatingView];

实现一个委托函数函数

-(void)starRatingView:(TQStarRatingView *)view score:(float)score
{
    self.scoreLabel.text = [NSString stringWithFormat:@"%0.2f",score * 10 ];
}

 

由于项目暂时不须要。这里没有写用代码设置星星显示位置的方法,之后有时间会补上。spa

控件的源代码放在 https://github.com/TinyQ/TQStarRatingView 上了。有须要能够去下载下。code

相关文章
相关标签/搜索