iOS-68-星星评价、显示小数点星星评价效果(附demo)
来源:互联网 发布:nodejs工程师 知乎 编辑:程序博客网 时间:2024/04/28 18:50
1、上效果图:
2、
第一个是显示的7.2分的评分
第二个可以点击选择评分
3、主要代码:
- (void)creatStarView{ UIImage *gray = [UIImage imageNamed:@"starGrey"]; UIImage *yellow = [UIImage imageNamed:@"strayellow"]; //1.获取星星视图的初始宽高 CGFloat width = gray.size.width *5; CGFloat height = gray.size.height; //2.初始化星星视图 _grayView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, height)]; [_grayView setBackgroundColor:[UIColor colorWithPatternImage:gray]]; // 平铺 [self addSubview:_grayView]; _yellowView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, height)]; [_yellowView setBackgroundColor:[UIColor colorWithPatternImage:yellow]]; // 平铺 [self addSubview:_yellowView]; //3.放大星星视图与self等高等宽 CGFloat scaleW = self.frame.size.width/width; CGFloat scaleH = self.frame.size.height/height; _grayView.transform = CGAffineTransformMakeScale(scaleW, scaleH); _yellowView.transform = CGAffineTransformMakeScale(scaleW, scaleH); //4.重置星星视图坐标 _grayView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height); _yellowView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);}-(void)setRating:(float)rating{// _rating = rating; _yellowView.frame = CGRectMake(0, 0, self.frame.size.width *rating/10, self.frame.size.height);}
demo:http://download.csdn.net/detail/iot_li/9603992
0 0
- iOS-68-星星评价、显示小数点星星评价效果(附demo)
- 评价星星点击效果
- 星星评价效果
- 评价星星效果
- 用星星显示评价
- 评价,星星
- 星星点击评价效果代码
- iOS评分(评价)星星图
- 优化的打分星星评价效果
- IOS 评价星星 Slider的使用
- Jquery星星评价插件
- 星星评价前后台
- js星星评价
- 页面星星评价
- JS里星星评价
- Android 星星评价
- 【转载】星星打分评价
- JQ实现星星评价(带半星)
- 实现指定路径的所有子路径
- RxJava学习笔记(一)
- 线段树 及 空间为什么是 4倍
- 【JavaScript】简单使用介绍
- oracle基础知识1----用户(创建用户)和表空间、管理表
- iOS-68-星星评价、显示小数点星星评价效果(附demo)
- 前端框架之Semantic UI
- 【杭电oj2040】亲和数
- 模拟题2(打表)
- 【算法】KMP经典算法,你真的懂了吗?
- LA 2911Maximum poj 3066
- 【游戏后端】游戏服务器端开发的一些建议(转载)
- bzoj 2763 JLOI 2011 飞行路线 分层图+spfa
- 二叉树的遍历思想及核心代码实现