【发布时间】:2011-03-03 01:25:38
【问题描述】:
《iPhone Programming. The Big Nerd Ranch Guide》一书引用了以下方法(第 96 页)
(void)mapView:(MKMapView *)mv didAddAnnotationViews:(NSArray *) views {
MKAnnotationView *annotationView = [views objectAtIndex:0];
id <MKAnnotation> mp = [annotationView annotation];
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance([mp coordinate], 250, 250);
[mv setRegion:region animated:YES];
}
我对星号的使用感到困惑。以“MKAnnotationView”开头的行和下面的行可以抽象的表示为:
ObjectType variableName = [object message];
问题:
- 在第一种情况下,星号在变量名之前,但在第二种情况下没有。为什么?
- 在使用星号的情况下,不应该是分配给nil的指针吗?
谢谢。
【问题讨论】:
标签: iphone objective-c