Objective C rateview 不显示一半图像
Objective C rateview not show half image
我正在像这个页面一样使用 rateview:
运行正常,但我看不到一半的图像显示,比如1.5- 1.5-3.5..
谁能帮我知道为什么?谢谢
使用 FloatRatingView 进行整点、半点或浮点评级控制。
我解决了这个问题,只需在 handlingTouchFunction 中添加一些代码即可
- (void)handleTouchAtLocation:(CGPoint)touchLocation {
if (!self.editable) return;
double newRating = 0;
for(int i = self.imageViews.count - 1; i >= 0; i--) {
UIImageView *imageView = [self.imageViews objectAtIndex:i];
if (touchLocation.x > (imageView.frame.origin.x)) {
if(touchLocation.x <= (imageView.frame.origin.x + imageView.frame.size.width / 2))
newRating = i + 0.5;
else
newRating = i + 1;
break;
}
}
self.rating = newRating;
}
我正在像这个页面一样使用 rateview:
运行正常,但我看不到一半的图像显示,比如1.5- 1.5-3.5..
谁能帮我知道为什么?谢谢
使用 FloatRatingView 进行整点、半点或浮点评级控制。
我解决了这个问题,只需在 handlingTouchFunction 中添加一些代码即可
- (void)handleTouchAtLocation:(CGPoint)touchLocation {
if (!self.editable) return;
double newRating = 0;
for(int i = self.imageViews.count - 1; i >= 0; i--) {
UIImageView *imageView = [self.imageViews objectAtIndex:i];
if (touchLocation.x > (imageView.frame.origin.x)) {
if(touchLocation.x <= (imageView.frame.origin.x + imageView.frame.size.width / 2))
newRating = i + 0.5;
else
newRating = i + 1;
break;
}
}
self.rating = newRating;
}