开发者

how can I add multiple images on the button?

开发者 https://www.devze.com 2023-02-27 05:30 出处:网络
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 r开发者_JS百科ating

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 r开发者_JS百科ating 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..


HI,

Check the below code

http://code.google.com/p/s7ratingview/

Here's another open source solution:

https://github.com/dlinsin/DLStarRating

how can I add multiple images on the button?


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]


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

0

精彩评论

暂无评论...
验证码 换一张
取 消