0
我有一個圖像,我想要在用戶位置的右側,我該如何去做呢?有沒有辦法獲得用戶位置的x和y座標,然後獲取圖像的x和y以確保其始終位於右側?找到用戶位置的x和y座標
-(void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation{
MKCoordinateRegion region;
region.center = worldView.userLocation.coordinate;
MKCoordinateSpan span;
span.latitudeDelta = 5;
span.longitudeDelta = 5;
region.span = span;
[worldView setRegion:region animated:YES];
UIImage *commentBox = [UIImage imageNamed:@"comment-box"];
UIImageView *commentBoxImageView = [[UIImageView alloc] initWithImage:commentBox];
[self.view addSubview:commentBoxImageView];
}