0

我在谷歌地图中有一些注释,我必须将按钮选择器上的纬度和经度值发送到另一个方法,我试图在“标签”中设置,但它返回空值,知道为什么

NSString *str = [NSString stringWithFormat:@"%f, %f", annotation.coordinate.latitude, annotation.coordinate.longitude];

       // NSLog(@"%@",str);

        UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeCustom];
        rightButton.frame = CGRectMake(30, 0, 32, 32);
        [rightButton setImage:[UIImage imageNamed:@"getdirections.png"] forState:UIControlStateNormal];
        [rightButton setTitle:annotation.title forState:UIControlStateNormal];

        [rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside];
        annotationView.rightCalloutAccessoryView = rightButton;
        return annotationView;

提前致谢

4

0 回答 0