Calling methods between view controllers using Storyboard?

Up vote 0 down vote favorite share g+ share fb share tw.

I've already read the post Passing data to views using Storyboards, but still have problem with calling methods: Now I have AViewController and BViewController, both connected with Storyboard (no XIBs). In BViewController : -(void)doSth:(int)num; So how can I call the doSth: method in AViewController? The old way like bViewController doSth:123; don't work because I can't get the instance of BViewController in the Storyboard.

Thanks. Peak iphone objective-c storyboard viewcontroller ios5 link|improve this question edited Jun 12 '11 at 6:59Binyamin Sharet37.9k52554 asked Jun 12 '11 at 6:48PeakJi709113 100% accept rate.

3 I have a possible answer but I was under the impression that the iOS 5 SDK was under NDA (outside of the official Apple developer forums). Can someone confirm/deny this? – Sam Jun 12 '11 at 7:40 2 Yes -- iOS 5 is under NDA and cannot be discussed here.

Ask this in the Apple dev forums. – bbum Jun 12 '11 at 16:07 I found a good post that explains in details how to do this: stackoverflow.com/questions/7920229/… – Johan Oct 31 '11 at 13:11.

I found if I use: MapViewController *mapView = self. Storyboard instantiateViewControllerWithIdentifier:@"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; I can call methods in MapViewController directly, aka mapView testMethod.

You need to implement the prepareForSegue:sender: method in your view controller. The first paramter is a UIStoryboardSegue object which has references to both the source and destination view controller. This should allow you to do your bViewController doSth:123; pretty much as before.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions