当我进入5个不同的区域时,我试图创建不同的警报。我目前正在设置这样的区域。。。
//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];
我可以很容易地再设置5个,但对于警报,我不太确定该怎么办。我目前正在使用这种方法。。。
- (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];
}
我不知道如何为每个地区定制它。很抱歉,如果这是一个愚蠢的问题,我是一个完全的初学者。有人能帮忙吗?提前感谢!
didEnterRegion为您提供了一个区域参数。您可以使用它来检查它是房间区域还是其他区域。将它们放在数组或字典中,这样你就可以将它们与你输入的区域进行比较。