Issue
Hello i have a mapView and i think it takes too much memory after leaving the mapView
here are my methods is anything missing?
- (void)viewDidUnload
{
mapView.showsUserLocation = NO; b
[mapView removeAnnotations:mapView.annotations];
[super viewDidUnload];
}
-(void)dealloc{
[name release];
[type release];
[address release];
mapView.delegate = nil;
[super dealloc];
}
- (void)viewDidLoad{
foundLocation = location found <----
MKCoordinateRegion region;
region.center.latitude = foundLocation.coordinate.latitude;
region.center.longitude=foundLocation.coordinate.longitude;
region.span.longitudeDelta=0.01;
region.span.latitudeDelta=0.01;
[mapView setRegion:region animated:NO];
ann = [[MapAnnotation alloc]init];
ann.title = name;
ann.subtitle = type;
ann.coordinate=region.center;
[mapView addAnnotation:ann];
[ann release];
self.navigationItem.title=@"Map";
[super viewDidLoad];
}
The map view also shows users location i think something is missing from the viewDidUnload method....
The MapAnnotation is a class that shows an annotation just holds a title and a subtitle.
i think the app keep tracking users location even if i leave the mapView.
Solution
After you set the delegate to nil, you did not call [mapView release]
Answered By - dbrajkovic
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.