title: Refresh the content within Google Maps iOS
body: <p>I am currently working with the Google Maps API for iOS. I have drawn markers on the maps, but I do not know how to "refresh" (delete markers and redraw new ones) the markers once the user has entered in new data from another class. I try to recall the map view class like this:</p>
  
  <p>This is the code, in another class (GetInfoViewController) that is executed when the user inputs new data</p>
  
  <pre><code>MapViewController *mapVC = [[MapViewController alloc]init];
  [mapVC resetMap];
  </code></pre>
  
  <p>This is what is inside the MapViewController</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
      mapView.myLocationEnabled = YES;
      mapView.settings.myLocationButton = YES;
      getpos = [[NSMutableArray alloc]init];
  
  }
  
  - (void)loadView {
  
      lat = [[NSMutableArray alloc]init];
      lng = [[NSMutableArray alloc]init];
      markers = [[NSMutableArray alloc]init];
      locationManager = [[CLLocationManager alloc] init];
      locationManager.distanceFilter = kCLDistanceFilterNone;
      locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 100 m
  
  
      [locationManager startUpdatingLocation];
  
      GMSCameraPosition *camera = [GMSCameraPosition   cameraWithLatitude:locationManager.location.coordinate.latitude
                                                              longitude:locationManager.location.coordinate.longitude                                                                 zoom:13.2];
  
      mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
      mapView.delegate = self;
  
      self.view = mapView;
      [mapView clear];
      [self createMarker];
  
  }
  
  
  - (void) createMarker {
  
      [lat removeAllObjects];
      [lng removeAllObjects];
      [markers removeAllObjects];
  
      AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  
      for (int x = 0; x &lt; [appDelegate.geocodedLatArrayGlobal count]; x++) {
          NSNumber *latCoord = [NSNumber numberWithDouble:[[appDelegate.geocodedLatArrayGlobal objectAtIndex:x]doubleValue]];
          [lat addObject: latCoord];
      }
  
      for (int x = 0; x &lt; [appDelegate.geocodedLngArrayGlobal count]; x++) {
          NSNumber *lngCoord = [NSNumber numberWithDouble:[[appDelegate.geocodedLngArrayGlobal objectAtIndex:x]doubleValue]];
          [lng addObject:lngCoord];
      }
  
      for (int x = 0; x &lt; [lat count]; x++) {
          double latitude =[[lat objectAtIndex:x]doubleValue];
          double longitude =[[lng objectAtIndex:x]doubleValue];
          CLLocationCoordinate2D position = CLLocationCoordinate2DMake(latitude,longitude) ;
          GMSMarker *marker = [GMSMarker markerWithPosition:position];
          marker.title = @"Title"
          marker.map = mapView;
          [markers addObject:marker];
  
      }
  
  }
  
  -(void)resetMap{
         NSLog(@"map reset");
         [mapView clear];
         [self createMarker];
  }
  </code></pre>
  
  <p>In GetInfoViewController: Changing the container content to MapViewController</p>
  
  <pre><code> MapViewController *viewController1 = [self.storyboard instantiateViewControllerWithIdentifier:@"vc1"];
      viewController1.view.frame = self.container.bounds;
  
      [viewController1 willMoveToParentViewController:self];
      [self.container addSubview:viewController1.view];
      [self addChildViewController:viewController1];
      [viewController1 didMoveToParentViewController:self];
      [UIView beginAnimations:nil context:nil];
  
      [UIView setAnimationDuration:1];
  
      [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight  forView:self.container cache:YES];
  
      [UIView commitAnimations];
  </code></pre>