Note that there are some explanatory texts on larger screens.

plurals
  1. POLoading view trying to remove previous view from stack
    primarykey
    data
    text
    <p>Scratching my head on this:</p> <p>I have a viewController with a "loading..." view that is called when I load another viewController with a MapKit view which searches for a location.</p> <p>On this "Loading..." view there is a cancel button which when clicked switches the view to the starting viewController. What is happening is when I switch to the starting view, the Map View still in the stack and updating the location in the background. I tried [locationmanager stopupdatinglocation] and I cannot get it to stop updating. All I need is to remove the map view from the stack alltogether,</p> <p>Can anyone help ?</p> <p>Thanks</p> <p>This is the back button code from the loading... view:</p> <pre><code>-(void)back{ [UIApplication sharedApplication].networkActivityIndicatorVisible=NO; Car_Park_AppViewController *appView = [[Car_Park_AppViewController alloc]initWithNibName:@"Car_Park_AppViewController" bundle:nil]; appView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController:appView animated:YES]; [appView release]; } </code></pre> <p>map view code</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; mapView.mapType = MKMapTypeSatellite; mapView.showsUserLocation=TRUE; loading *loadingView = [[loading alloc] init]; [super.view addSubview:loadingView.view]; locationManager = [[CLLocationManager alloc] init]; locationManager.delegate=self; locationManager.distanceFilter = kCLDistanceFilterNone; locationManager.desiredAccuracy = kCLLocationAccuracyBest; [locationManager startUpdatingLocation]; CLLocationCoordinate2D location; location.latitude = mapView.userLocation.location.coordinate.latitude; location.longitude = mapView.userLocation.location.coordinate.longitude; } - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { MyManager *mng = [MyManager sharedManager]; mng.startLocation = newLocation; MKCoordinateSpan span; span.latitudeDelta=.00001; span.longitudeDelta=.00001; MKCoordinateRegion region; region.center = newLocation.coordinate; region.span=span; [mapView setRegion:region animated:TRUE]; i++; NSTimeInterval locationAge = -[mng.endLocation.timestamp timeIntervalSinceNow]; NSLog(@"Accuracy %f",newLocation.horizontalAccuracy); if ((locationAge &lt; 5.0) &amp;&amp; (newLocation.horizontalAccuracy &lt; 30.1)){ [self recLocation]; i=0; } haveAlreadyReceivedCoordinates = YES; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload