Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 另一个视图控制器的调用出口_Iphone_Sdk_View_Controller_Call - Fatal编程技术网

Iphone 另一个视图控制器的调用出口

Iphone 另一个视图控制器的调用出口,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

嗨,伙计们, 我有一个MapperViewController

@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];