How to add star rating to UITableView cell?

后端 未结 4 1523
渐次进展
渐次进展 2021-01-16 03:08

I need to display a bunch of UITableViewCell in my iPhone application. Sample look below. I know how I can enable accessory view and image to UITableView cell

相关标签:
4条回答
  • 2021-01-16 03:21

    Maybe my FavStarControl is what you need? ;)

    0 讨论(0)
  • 2021-01-16 03:27

    This Matt Gallagher post helped me a ton when dealing with custom TableView cells http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html.

    Summary 1) Do not subclass UITableViewCell 2) In the cellForRowAtIndexPath method, layout your custom subviews on top of the dequeued UITableViewCell.

    To add a star just use a UIButton with the default image of a unhighlighted star and a selected image of a highlighted star.

    0 讨论(0)
  • 2021-01-16 03:32
    1. Take 5 images in a custom cell for stars
    2. Make their outlets in UITableViewCell
    3. create an NSMutableArray *starArray and CFFloat rating inside the interface
    4. inside the cellForRowAtIndexPath rating = any float value that can be 0,0.5,1,1.5 ..... and call (void)rightImageSet: this method will fill in all the images string you required for the particular rating.

    5. In rightImageSet apply the logic You can watch the images for further info.

    6. In a case anything is not clear comment

    0 讨论(0)
  • 2021-01-16 03:41

    I think you may find everything you need here : http://github.com/eisernWolf/TouchCustoms

    Either have a look at the code to have an idea of the code you need to use or just implement directly their source code into your project (do not forget to read carefully the license ;))

    But in my opinion, it should be fairly easy to make your own custom rating system :

    1. Make a star icon - one empty, one plain
    2. Create UIButtons with relevant icons
    3. Make sure to implement relevant touch events

    Okay, that's a summary :D but it shouldn't take too much time to build ;)

    0 讨论(0)
提交回复
热议问题