I'm trying to populate a UITableview with an array of cells. I usually do this from the viewDidLoad method but this time I want to populate the array based on location. Below is the first line of my interface:
@interface RootViewController : UITableViewController {
In the implementation file the viewDidLoad method looks like this:
- (void)viewDidLoad {
// for location
self.locationManager = [[CLLocationManager alloc] init];
[locationManager startUpdatingLocation];
locationManager.delegate = self;
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[super viewDidLoad];
}
I populate the array of cells in the didUpdateToLocation method:
self.title = @"Open Buildings";
NSMutableArray *buildingArray = [[NSMutableArray alloc] initWithObjects:building1,
self.controllers = array;
The title of the view updates when location is found but the array doesn't populate. The array did populate before when I had the above code in the viewdidupdate. I had to move it to the didupdatelocation method because the application won't have the location info when the view loads in the viewDidLoad method.
Please help and thanks!