Map 插针详图索引视图的详细视图希望给出不同的值

Map 插针详图索引视图的详细视图希望给出不同的值,map,annotations,xcode4.2,callout,Map,Annotations,Xcode4.2,Callout,这是我的密码 @implementation AnnotationViewController @synthesize mapView; -(void)viewDidLoad { [super viewDidLoad]; [mapView setMapType:MKMapTypeStandard]; [mapView setZoomEnabled:YES]; [mapView setScrollEnabled:YES]; [mapView setDel

这是我的密码

@implementation AnnotationViewController
@synthesize mapView;

-(void)viewDidLoad {

    [super viewDidLoad];
    [mapView setMapType:MKMapTypeStandard];
    [mapView setZoomEnabled:YES];
    [mapView setScrollEnabled:YES];
    [mapView setDelegate:self];

    MKCoordinateRegion bigBen = { {0.0, 0.0} , {0.0, 0.0} };
    bigBen.center.latitude = 51.50063;
    bigBen.center.longitude = -0.124629;
    bigBen.span.longitudeDelta = 0.02f;
    bigBen.span.latitudeDelta = 0.02f;
    [mapView setRegion:bigBen animated:YES];

    Annotation *ann1 = [[Annotation alloc] init];
    ann1.title = @"Big Ben";
    ann1.subtitle = @"Your subtitle";
    ann1.coordinate = bigBen.center;
    [mapView addAnnotation: ann1];

    MKCoordinateRegion Bridge = { {0.0, 0.0} , {0.0, 0.0} };
    Bridge.center.latitude = 51.500809;
    Bridge.center.longitude = -0.120914;
    Bridge.span.longitudeDelta = 0.02f;
    Bridge.span.latitudeDelta = 0.02f;
    [mapView setRegion:Bridge animated:YES];

    Annotation *ann2 = [[Annotation alloc] init];
    ann2.title = @"Westminster Bridge";
    ann2.subtitle = @"Your subtitle";
    ann2.coordinate = Bridge.center;
    [mapView addAnnotation:ann2];

}

-(MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {


    MKPinAnnotationView *MyPin=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"current"];
    MyPin.pinColor = MKPinAnnotationColorGreen;

    UIButton *advertButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    [advertButton addTarget:self action:@selector(button:) forControlEvents:UIControlEventTouchUpInside];

    MyPin.rightCalloutAccessoryView = advertButton;
    MyPin.draggable = NO;
    MyPin.highlighted = YES;
    MyPin.animatesDrop=TRUE;
    MyPin.canShowCallout = YES;


    return MyPin;
}
-(void)button:(id)sender {

    NSLog(@"Button action");
    [self performSegueWithIdentifier:@"detail" sender:sender];
    [self performSegueWithIdentifier:@"under" sender:sender];
}
@实现注释ViewController
@综合地图视图;
-(无效)viewDidLoad{
[超级视图下载];
[mapView setMapType:MKMapTypeStandard];
[mapView SetZoomeEnabled:是];
[地图视图设置可克隆:是];
[mapView setDelegate:self];
MKCoordinateRegion bigBen={{0.0,0.0},{0.0,0.0};
大本中心纬度=51.50063;
bigBen.center.longitude=-0.124629;
bigBen.span.longitudeDelta=0.02f;
bigBen.span.latitudeDelta=0.02f;
[地图视图设置区域:bigBen动画:是];
注释*ann1=[[Annotation alloc]init];
ann1.title=@“大本钟”;
ann1.subtitle=@“您的字幕”;
ann1.coordinate=bigBen.center;
[地图视图添加注释:ann1];
MKCoordinateRegion Bridge={{0.0,0.0},{0.0,0.0};
桥中心纬度=51.500809;
Bridge.center.longitude=-0.120914;
桥跨长D=0.02f;
Bridge.span.latitudeDelta=0.02f;
[地图视图设置区域:桥动画:是];
注释*ann2=[[Annotation alloc]init];
ann2.title=@“威斯敏斯特桥”;
ann2.subtitle=@“您的字幕”;
ann2.coordinate=Bridge.center;
[地图视图添加注释:ann2];
}
-(MKAnnotationView*)地图视图:(MKMapView*)地图视图注释:(id)注释{
MKPinAnnotationView*MyPin=[[MKPinAnnotationView alloc]initWithAnnotation:annotation重用标识符:@“current”];
MyPin.pinColor=MKPinAnnotationColorGreen;
UIButton*advertButton=[UIButton Button类型:UIButtonTypedTailDisclosure];
[advertButton addTarget:self action:@selector(按钮:)for ControlEvents:UIControlEventTouchUpInside];
MyPin.rightCalloutAccessoryView=广告按钮;
MyPin.draggable=否;
MyPin.highlighted=是;
MyPin.animatesDrop=TRUE;
MyPin.canShowCallout=是;
返回MyPin;
}
-(无效)按钮:(id)发送者{
NSLog(“按钮动作”);
[self-PerformsgueWithIdentifier:@“详细信息”发件人:发件人];
[self-PerformsgueWithIdentifier:@“发件人:发件人”下];
}
单击“更多”按钮后,如果您愿意,每个管脚都已处于不同的视图中 我甚至不知道怎么做这个。 无论当前状态如何,请选择具有相同详细信息页面的任何pin 例如 它是大本钟出来的按钮被按下,webview 威斯敏斯特大桥被迫来到textview 我想做些什么。 注意,我可以使用xcode 4.2版本和情节提要。 这里有几天的时间我会感谢你的。

-(无效)按钮:(id)发送者{if([mapView.selectedAnnotations count]>=1){[self-PerformsgueWithIdentifier:@“detail”发送者:发送者];([[mapView.selectedAnnotations objectAtIndex:0]标题];//NSLog([[mapView.selectedAnnotations objectAtIndex:0]标题]);}否则如果([mapView.selectedAnnotations count]>=2){[sender:sender]下的[self-PerformsgueWithIdentifier:@];([mapView.selectedAnnotations objectAtIndex:1]标题];}它不起作用,我需要你的帮助;;;如果我单击了注释调出按钮,则另一个注释-->与下一页相同;
// You can probably use the property selectedAnnotations in MKMapView
// You might want to consider adding some more error checking

-(void)button:(id)sender {
    if ([mapView.selectedAnnotations count] >= 1) {
        NSLog(@"%@title = %@", [[mapView.selectedAnnotations objectAtIndex:0] title]);
    }
}