Our review form UI is set up, but we need to make a slight change to it. Right now, we have an image displayed for ratings. We are going to build a custom rating component that we will use in both restaurant details and our Review form.
We add it to our restaurant details first, then once we are finished, we add it to the Review form. We want our ratings view to be able to show ratings from zero stars to five stars. We also want the user to be able to select half stars when rating, so it will also need to show half stars.
The first thing we do is start creating our custom UIControl
. UIButtons
and UISwitches
are sub-classes of UIControls
, and without getting super technical, we are going to create our control:
- Right click the
Reviews Form
folder and selectNew File
. - Inside of the
Choose a template for your new file
screen, selectiOS
at the top, and thenCocoa Touch Class
. Then, hitNext
. - In the options screen that appears, add the following:
New file:
Class
:RatingsView...