#Location Trivia Objects
In the last lab you dealt with NSDictionary object representation of locations. Now lets convert these to proper classes and add in trivia items!
-
First create a new
FISLocationclass, add in the properties from theNSDictionary. So name, latitude and longitude -
Move the
shortenLocationNamemethod to an instance method for yourFISLocationclass. Do you need theNSDictionarylocation argument anymore? -
Create an initializer that takes in the three properties and assigns them correctly
-
Modify the
getLocationNamesWithLocationsmethod to take anNSArrayofFISLocationobjects and just return their names -
Move the
verifyLocationmethod to be an instance method forFISLocationand still returnYESorNOwhether theFISLocationhas all of it's properties filled out -
Create a designated init method for FISLocation.
-
Modify the
searchForLocationName:inLocations:method to search anNSArrayofFISLocationobjects. -
Create a new class called
FISTrivia. This class should have the following properties:- (NSString *) content - (NSInteger) likes -
Add an
NSMutableArrayproperty toFISLocationto hold trivia items -
Write a method called
topTriviathat returns the trivia item with the most likes. Where should this method go? -
Create an initializer for
FISTriviathat takes an argument for all of the properties and sets them appropriately