且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Storyboard在视图控制器之间调用方法

更新时间:2022-11-11 21:16:50

我发现如果我使用:

MapViewController *mapView = [self.storyboard instantiateViewControllerWithIdentifier:@"MapView"];

(MapView是我在故事板中为该场景/视图设置的标识符)

("MapView" is the identifier i set for that scene/view in storyboard)

我只是测试了旧的方式,它适用于我:

and i just tested the old way and it works for me:

mapViewController *mapView = [[mapViewController alloc] initWithNibName:@"mapViewController" bundle:[NSBundle mainBundle]];

我可以直接调用MapViewController中的方法,又名

i can call methods in MapViewController directly, aka

[mapView testMethod];