Created
August 10, 2012 06:07
-
-
Save infinityrobot/3311622 to your computer and use it in GitHub Desktop.
Revisions
-
infinityrobot revised this gist
Aug 10, 2012 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ // I have included a few steps in here to show the flow I normally do to get things working. // Keep in mind I'm still a massive noob so there may be a better way to do all of this :/ // ... -
infinityrobot created this gist
Aug 10, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ // I have included a few steps in here to show the flow I normally do to get things working. Keep in mind I'm still a massive noob so there may be a better way to do all of this :/ // ... // Class definition and imports // STEP 1: Declare vars in the controller @interface @interface MapViewController : UIViewController <MKMapViewDelegate, UISearchBarDelegate> { // ... // Interface objects MKMapView *mapView; UISearchBar *searchBar; // ... // Result objects NSMutableArray *results; NSMutableData *requestData; } // STEP 2: Declare properties of all above declared vars // Interface objects @property (nonatomic, retain) MKMapView *mapView; @property (nonatomic, retain) UISearchBar *searchBar; // Result objects @property (nonatomic, retain) NSMutableArray *results; @property (nonatomic, retain) NSMutableData *requestData; // ... // Function definitions etc. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ // Top of .m // ... // Imports // Implementation #pragma mark - MapViewController @implementation MapViewController // STEP 3: Synthesize the set ivars @synthesize mapView, searchBar, results, requestData // STEP 4: Now you should be able to use them :) // NOTE: If you are using ARC - if you want to allocate a set variable to memory and persist it then do: results = [NSMutableArray array]; // from memory? // NOTE: If you are not using ARC: results = [[NSMutableArray alloc] init] // I only ever use @syntesize to connect the .h and .m - as I said I might be wrong but it has worked for me so far haha // If anyone else wants to correct me somewhere please do :) I'm keen to learn!