TheLearner
TheLearner

Reputation: 19507

How to create a custom UIView that shows 5 stars

I have a requirement for a UIView that displays stars similar to the way one can rate albums in iTunes on the Mac and iPhone.

Does anyone know what it would involve to create this or whether one is available online?

Upvotes: 0

Views: 967

Answers (2)

B K
B K

Reputation: 1564

I had it done it a couple of months back. It is very simple.

  • Subclass a UIView.
  • Add the 5 stars(UIImageviews)
  • Write a function to toggle the image of the stars
  • In the touches Began and touches moved method Check for the touch and accordingly change the images of the imageviews.
  • Also add a int variable that will have the current rating.(you can set the value whenever the toggle changes the images of the stars)

Upvotes: 1

Jacob Relkin
Jacob Relkin

Reputation: 163308

Have a look at the TouchCustoms library. I'm pretty sure there's a star rating component for iOS in there.

Upvotes: 2

Related Questions