I am trying to create different alerts when entering 5 different regions. I’m currently setting up the regions like this…
//Monitoring a Region
CLLocationCoordinate2D layerCoords =
CLLocationCoordinate2DMake(53.385909, -6.260067);
CLRegion *layerRoom = [[CLRegion alloc]
initCircularRegionWithCenter:layerCoords
radius:100
identifier:@"layerRoom"];
// Start monitoring for our CLRegion using best accuracy
[locationManager startMonitoringForRegion:layerRoom
desiredAccuracy:kCLLocationAccuracyBest];
and I can easily just set up 5 more but for alerts I’m not quite sure what to do. I’m currently using this method…
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {
UIAlertView *locationAlert = [[UIAlertView alloc]
initWithTitle:@"Success!" message:@"You have arrived!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
// Display the alert
[locationAlert show];
}
And I don’t know how to customize it for each region. Sorry if it’s a dumb question, I’m a complete beginner. Can anybody help? Thanks much in advance!
didEnterRegion gives you a region parameter. You can use that to check if it’s the roomRegion or some other region. Keep them around in an array or dictionary or whatever so you can compare them to the region you have entered.