Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-24-2009, 08:34 PM   #1 (permalink)
Registered Member
 
Innovation's Avatar
 
Join Date: Nov 2009
Location: Toronto
Posts: 38
Innovation is on a distinguished road
Default Custom view for star ratings

I am writing a book application which allows users to rate books on a 1 - 5 star scale. I need a custom View for implementing this. I am thinking of doing this by using a subclass of UIImageView and detecting the tap location tap within the view and swapping in active or inactive stars to indicate the rating. Has anyone done something like this before of is there a better way of doing this?

Thanks.
Innovation is offline   Reply With Quote
Old 11-24-2009, 10:45 PM   #2 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: Pune, India
Posts: 314
Akshay Shah is on a distinguished road
Send a message via Skype™ to Akshay Shah
Smile

Quote:
Originally Posted by Innovation View Post
I am writing a book application which allows users to rate books on a 1 - 5 star scale. I need a custom View for implementing this. I am thinking of doing this by using a subclass of UIImageView and detecting the tap location tap within the view and swapping in active or inactive stars to indicate the rating. Has anyone done something like this before of is there a better way of doing this?

Thanks.
I guess, instead of subclassing imageView it would be better if you subclass UIView.
Have 5 imageView objects in it for 5 stars and detect touches using CGRectContainsPoint.
This would help you create a generalized custom view which you could use in some of your other apps also... as it is!!!!

I havent implemented this yet, but would have done it the way mentioned above if required....

Regards,
Akshay Shah.
__________________
If you think I did help you, you can always thank me by buying
iHoldMore - A very nice and addictive game...

Need a mobile app. Contact Us.
Ruby Solutions Pvt. Ltd.
You can mail me at akshay@ruby-solutions.com
Akshay Shah is offline   Reply With Quote
Old 11-28-2009, 03:28 PM   #3 (permalink)
Registered Member
 
Innovation's Avatar
 
Join Date: Nov 2009
Location: Toronto
Posts: 38
Innovation is on a distinguished road
Default

Quote:
Originally Posted by Akshay Shah View Post
I guess, instead of subclassing imageView it would be better if you subclass UIView.
Have 5 imageView objects in it for 5 stars and detect touches using CGRectContainsPoint.
This would help you create a generalized custom view which you could use in some of your other apps also... as it is!!!!

I havent implemented this yet, but would have done it the way mentioned above if required....

Regards,
Akshay Shah.
Thanks for the suggestion Akshay. I implemented it the way you said but for detecting touches i just used locationInView of the parent ratings view and set the imageView images to either bright or dark stars depending on the x position. Works great
Innovation is offline   Reply With Quote
Old 11-30-2009, 04:02 AM   #4 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: Pune, India
Posts: 314
Akshay Shah is on a distinguished road
Send a message via Skype™ to Akshay Shah
Cool

Quote:
Originally Posted by Innovation View Post
Thanks for the suggestion Akshay. I implemented it the way you said but for detecting touches i just used locationInView of the parent ratings view and set the imageView images to either bright or dark stars depending on the x position. Works great
gr8...
All the best....

Regards,
Akshay Shah.
__________________
If you think I did help you, you can always thank me by buying
iHoldMore - A very nice and addictive game...

Need a mobile app. Contact Us.
Ruby Solutions Pvt. Ltd.
You can mail me at akshay@ruby-solutions.com
Akshay Shah is offline   Reply With Quote
Old 03-04-2010, 04:06 AM   #5 (permalink)
Registered Member
 
Join Date: Mar 2010
Posts: 1
eisernWolf is on a distinguished road
Default

See this: SCRatingView - TouchCustoms - GitHub
eisernWolf is offline   Reply With Quote
Old 03-04-2010, 04:44 AM   #6 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 17
karthikwifin is on a distinguished road
Default

Instead of UIImageView, Why not you use UIButton with custom image?
karthikwifin is offline   Reply With Quote
Reply

Bookmarks

Tags
custom, custom view, imageview, ratings, star

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 330
13 members and 317 guests
akacaj, alexP, ClerurcifeDer, Duncan C, givensur, GraffitiCircus, guusleijsten, JmayLive, NetGuru, Paul Slocum, Punkjumper, Sloshmonster, yys
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,114
Posts: 402,883
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:46 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0