Iphone 另一个视图控制器的调用出口
嗨,伙计们, 我有一个MapperViewControllerIphone 另一个视图控制器的调用出口,iphone,sdk,view,controller,call,Iphone,Sdk,View,Controller,Call,嗨,伙计们, 我有一个MapperViewController @interface MapperViewController : UIViewController <MKMapViewDelegate> { MKMapView *mapView; } @property (nonatomic, retain) IBOutlet MKMapView *mapView; @end 我在另一个名为RootViewController的类中有另一个对象,我在其中添加了上面的值。ofc
@interface MapperViewController : UIViewController <MKMapViewDelegate>
{
MKMapView *mapView;
}
@property (nonatomic, retain) IBOutlet MKMapView *mapView;
@end
我在另一个名为RootViewController的类中有另一个对象,我在其中添加了上面的值。ofc我有一个Firma类
firmenArray = [[NSMutableArray alloc] init];
Firma * aFirma = [[Firma alloc] init];
aFirma.title = @"title";
aFirma.boxOfficeGross = [NSNumber numberWithInt: 200000000];
aFirma.summary = @"summary";
aFirma.name = @"name";
aFirma.subtitle = @"subtitle";
aFirma.coordinate = CLLocationCoordinate2DMake(10.123,10.123);
[mapView addAnnotation:aFirma];
[firmenArray addObject: aFirma];
[aFirma release];
我要做的是调用[mapView addAnnotation:aFirma];在这个视图控制器中。
我在MapperViewController中有更多调用mapView的函数,因此它必须留在那里
有人能帮我吗
谢谢为什么不尝试将MKMapView作为RootViewController的成员变量
或者,也欢迎您在Object-C中设置委托层次结构,以便您的RootViewController和MapperViewController能够以父子方式通信
firmenArray = [[NSMutableArray alloc] init];
Firma * aFirma = [[Firma alloc] init];
aFirma.title = @"title";
aFirma.boxOfficeGross = [NSNumber numberWithInt: 200000000];
aFirma.summary = @"summary";
aFirma.name = @"name";
aFirma.subtitle = @"subtitle";
aFirma.coordinate = CLLocationCoordinate2DMake(10.123,10.123);
[mapView addAnnotation:aFirma];
[firmenArray addObject: aFirma];
[aFirma release];