Hi guys,
I know ARC exists but I'd rather work on learning manual memory management on iOS and just have a question:
I have this method:
I am I correct for NOT releasing the objects in bold? My understanding is that since they are convenience methods (I hope thats the correct terminology) that they are not to be released and that the class takes care of that for me since they were not created using alloc, or init.
I just want to reaffirm my understanding of this.
I know ARC exists but I'd rather work on learning manual memory management on iOS and just have a question:
I have this method:
Code:
-(void)foundLocation:(CLLocation *)loc
{
CLLocationCoordinate2D coord = [loc coordinate];
[B]//Create date string
NSDate *currentDate = [NSDate date];
NSString *date = [NSDateFormatter localizedStringFromDate:currentDate
dateStyle:NSDateFormatterShortStyle
timeStyle:NSDateFormatterShortStyle];[/B]
//Create an instance of MapPoint with the current data
MapPoint *mp = [[MapPoint alloc] initWithCoordinate:coord
title:[locationTitleField text]
subtitle:date];
//Add it to the map view
[worldView addAnnotation:mp];
//MKMapview retains its annotations, we can release
[mp release];
//Zoom the region to this location
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(coord, 250, 250);
[worldView setRegion:region animated:YES];
[locationTitleField setText:@""];
[activityIndicator stopAnimating];
[locationTitleField setHidden:NO];
[locationManager stopUpdatingLocation];
}
I am I correct for NOT releasing the objects in bold? My understanding is that since they are convenience methods (I hope thats the correct terminology) that they are not to be released and that the class takes care of that for me since they were not created using alloc, or init.
I just want to reaffirm my understanding of this.