Guest User

Untitled

a guest
May 23rd, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. - (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view{
  2.  
  3. NSLog(@" pin selected ");
  4. [self openInMap:invitationArray];
  5. calloutView = [[MAKRCalloutView alloc] initWithFrame:CGRectMake(0.0, 0.0, 292.0, 90.0)];
  6.  
  7. calloutView.titleLabel.text = view.annotation.title;
  8. calloutView.informationLabel.text =seats;
  9. calloutView.distanceLabel.text=confirmStatusStr;
  10. calloutView.distanceLabel.textColor=[UIColor redColor];
  11. //calloutView.distanceLabel.hidden=YES;
  12.  
  13. UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(confirmPress)];
  14. tapGestureRecognizer.numberOfTapsRequired = 1;
  15. [calloutView.distanceLabel addGestureRecognizer:tapGestureRecognizer];
  16. calloutView.distanceLabel.userInteractionEnabled = YES;
  17.  
  18.  
  19. [calloutView.imageView setImageWithURL :[NSURL URLWithString:imageStr]];
  20.  
  21.  
  22. calloutView.ratingView.value=ratingStr;
  23.  
  24. calloutView.offerLabel.text=offerStr;
  25.  
  26. calloutView.reviewLabel.text=@"0 Reviews";
  27. calloutView.subtitleLabel.text = view.annotation.subtitle;
  28.  
  29. UITapGestureRecognizer *tapGesture=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(navigateToTrip)];
  30.  
  31. [calloutView addGestureRecognizer:tapGesture];
  32.  
  33.  
  34. calloutView.center = CGPointMake(CGRectGetWidth(view.bounds) / 2.0, 0.0);
  35. [view addSubview:calloutView];
  36.  
  37. }
  38.  
  39.  
  40. - (void)mapView:(MKMapView *)mapView didDeselectAnnotationView:(MKAnnotationView *)view {
  41. for (UIView *subview in view.subviews) {
  42. if (![subview isKindOfClass:[MAKRCalloutView class]]) {
  43. continue;
  44. [subview removeFromSuperview];
  45. }
  46.  
  47. // [subview removeFromSuperview];
  48.  
  49. [self navigateToTrip];
  50. }
  51. }
Add Comment
Please, Sign In to add comment