我正在查看直接从Apple 网站上提供的CurrentAddress 示例中的 MapViewController.m 文件中提取的代码:
- (void)dealloc
{
[reverseGeocoder release];
[mapView release];
[getAddressButton release];
[super dealloc];
}
- (IBAction)reverseGeocodeCurrentLocation
{
self.reverseGeocoder =
[[[MKReverseGeocoder alloc] initWithCoordinate:mapView.userLocation.location.coordinate] autorelease];
reverseGeocoder.delegate = self;
[reverseGeocoder start];
}
我想知道分配对象时自动释放的功能是什么。(reverseGeocoder 是 MapViewController 类中的一个 ivar,设置有 retain 属性。)我的应用程序中有类似的代码,它似乎可以工作。