有没有类似的动作:
if (previous_view.title = @"newyork")
{
mapPin.pinColor = MKPinAnnotationColorGreen;
}
if (previous_view.title = @"washington")
{
mapPin.pinColor = MKPinAnnotationColorPurple;
}
我正在创建一个有地图的应用程序,如果您单击图钉的注释,它会导致一个带有按钮图的屏幕,如果我单击它,那么图钉需要更改为不同的颜色,我是想知道是否存在这样的动作,它会基于前一个视图的名称或任何其他属性(它来自哪里)。
这是我按下注释后用于转到下一个屏幕的代码:
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
if ([view.annotation.title isEqual: @"New York"])
{
newyork *controller1 = [[[newyork alloc] initWithNibName:@"newyork" bundle:nil] autorelease];
controller1.delegate = self;
controller1.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentViewController:controller1 animated:YES completion:nil];
}
}
这是 newyork.m 文件中的代码,它是按下地图按钮时发生的操作:
- (IBAction)mapPressed:(id)sender
{
map *controller1 = [[[map alloc] initWithNibName:@"map" bundle:nil] autorelease];
controller1.delegate = self;
controller1.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentViewController:controller1 animated:YES completion:nil];
}
我真的需要帮助!任何帮助表示赞赏。