Cosmos icon indicating copy to clipboard operation
Cosmos copied to clipboard

Is there a way to make star size fit the size of the view?

Open acecilia opened this issue 8 years ago • 9 comments

So it can be adjusted to different device screens. Thanks!

acecilia avatar May 30 '16 17:05 acecilia

Hi @acecilia, no, unfortunately the star sizes are not adjusted to the size of the cosmos view at the moment. It works the other way around, you set the size of a single star and the view adjusts its size to that. It works similar to a UILabel where you adjust the font size.

cosmosView.settings.starSize = 30

But I realize that the auto-size mode can be handy, thank you for the idea. I will think how it can be done.

evgenyneu avatar May 30 '16 22:05 evgenyneu

Hi, has this been fixed yet?

TPAD avatar Jun 12 '16 02:06 TPAD

Hi @TPAD, no, unfortunately, the auto-size feature has not been implemented yet.

evgenyneu avatar Jun 12 '16 05:06 evgenyneu

@TPAD you can get a similar behavior by setting an aspect ratio constraint to it

acecilia avatar Jun 12 '16 13:06 acecilia

@acecilia I'd like to know how that works? Setting an aspect ratio constraint to the CosmosView doesn't make the stars grow when the View grows.

tiuya avatar Feb 16 '17 10:02 tiuya

+1

siideffect avatar Jul 17 '17 17:07 siideffect

@tiuya @siideffect sorry, just saw this. Its been a long time I stopped working with this code and I do not remember how I finally managed.

acecilia avatar Jul 17 '17 17:07 acecilia

Actually, I am using this method, and I would be happy to share it with you:

let countStars = 5
ratingbar.starMargin = 2
ratingbar.starSize = (ratingbar.frame.width/countStars)-(ratingbar.starMargin) //star size gonna stretch with the width of the ratingbar

mohasalahh avatar Sep 20 '18 21:09 mohasalahh

This feature would be a very useful and actually necessary addition.

Isuru-Nanayakkara avatar Sep 11 '19 11:09 Isuru-Nanayakkara