我有我的所有注释安装到屏幕的问题......有时它会显示所有注释,但另外一些时候应用在两个注释之间放大,使他们都不是可见的.我希望应用程序始终使区域适合注释而不是放大它们之间...我做错了什么?
if ([mapView.annotations count] == 2) {
CLLocationCoordinate2D SouthWest = location;
CLLocationCoordinate2D NorthEast = savedPosition;
NorthEast.latitude = MAX(NorthEast.latitude, savedPosition.latitude);
NorthEast.longitude = MAX(NorthEast.longitude, savedPosition.longitude);
SouthWest.latitude = MIN(SouthWest.latitude, location.latitude);
SouthWest.longitude = MIN(SouthWest.longitude, location.longitude);
CLLocation *locSouthWest = [[CLLocation alloc] initWithLatitude:SouthWest.latitude longitude:SouthWest.longitude];
CLLocation *locNorthEast = [[CLLocation alloc] initWithLatitude:NorthEast.latitude longitude:NorthEast.longitude];
CLLocationDistance meter = [locSouthWest distanceFromLocation:locNorthEast];
MKCoordinateRegion region;
region.span.latitudeDelta = meter / 111319.5;
region.span.longitudeDelta = 0.0;
region.center.latitude = (SouthWest.latitude + NorthEast.latitude) / 2.0;
region.center.longitude = (SouthWest.longitude + NorthEast.longitude) / 2.0;
region = [mapView regionThatFits:region];
[mapView setRegion:region …Run Code Online (Sandbox Code Playgroud) 基本上,我尝试做的是添加多个确认页...但我不能让它工作.无论我按什么确认,"继续"按钮都会导致完全相同的事情(没有文字的主体和带有"XXXX"的主题)...任何想法如何让confimationalerts导致不同的东西?
编辑2; 无论我按什么按钮(继续或解除),应用程序都会将用户发送到mail.app ...
-(IBAction)mail {
UIAlertView *mail = [[UIAlertView alloc] init];
[mail setTag:ALERTVIEW_MAIL_TAG];
[mail setTitle:@"Open mail"];
[mail setMessage:@"....."];
[mail setDelegate:self];
[mail addButtonWithTitle:@"Continue"];
[mail addButtonWithTitle:@"Dismiss"];
[mail show];
[mail release];
}
-(IBAction)feedback {
UIAlertView *feedback = [[UIAlertView alloc] init];
[feedback setTag:ALERTVIEW_TIPSA_TAG];
[feedback setTitle:@"Open mail"];
[feedback setMessage:@"....."];
[feedback setDelegate:self];
[feedback addButtonWithTitle:@"Continue"];
[feedback addButtonWithTitle:@"dismiss"];
[feedback show];
[feedback release];
}
- (void)showConfirmAlert
{
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if([alertView tag] == ALERTVIEW_FEEDBACK_TAG) {
NSURL *url = [[NSURL alloc] initWithString:@"mailto:?subject=XXXX"];
[[UIApplication sharedApplication] openURL:url];
[url …Run Code Online (Sandbox Code Playgroud) iphone ×2
alert ×1
confirmation ×1
ios4 ×1
mapkit ×1
mkannotation ×1
mkmapview ×1
uialertview ×1