メソッドに戻り値の型があるメソッド内で NSAutoreleasePool を設定するにはどうすればよいですか? それを行う方法はありますか?以下のような方法のように:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation, AddressAnnotation>) annotation;
または、次のようなオーバーライドされたメソッド内で:
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated;
以下のように main.m ファイルで確認できます。
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
//Do anything here
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
では、こうあるべきなのだろうか?