Reputation: 313
HI, all
how can I add multiple images on the button? in iphone.. b/c I have only one imaeg of Rating(star) and I want to insert this image through my rating numbers (i,e. if the rating is 8.1) then the images is shown is 4... just like the rating shown in the images..
any tutorial or code you have .. then plz send it to me..
Upvotes: 2
Views: 2085
Reputation: 4668
A UIButton is like any other view that you can call addSubview:
[myButton addSubview:someImageView];
I'd also recommend taking a look at the TouchCustoms library which has a RatingView that is very simple to use so you don't have to worry about managing those images yourself.
https://github.com/nesterow/TouchCustoms
Upvotes: 1
Reputation: 6132
You could create a custom UIButton, and place five UIImageView's on it. Create IBOutlets for all of them.
Then, in your code, according to the score received, use a for-loop to fill the UIImageView's needed through: [imageView setImage:ratingStarPicture]
Upvotes: 1
Reputation: 31722
HI,
Check the below code
http://code.google.com/p/s7ratingview/
Here's another open source solution:
https://github.com/dlinsin/DLStarRating
Upvotes: 1