سؤال

I did an experiment in viewDidLoad where I put:

NSLog(@"The View did load :-) %@", self.title);

inside of viewDidLoad.... so each time I segue'd to my different views I watched the output change but I'm lost in the "conceptual" groundwork of things.

Where do I put my code for each view? Xcode gives me the one ViewController.m, but shouldn't I create a separate ViewController.m for each view that I have in my storyboard and then each view has its own viewDidLoad?

I just watched the WWDC video on Segues/Storyboarding and going to play around with prepareForSegue:sender: to pass data between my views. None of the books I have touch on Storyboarding.

هل كانت مفيدة؟

المحلول

Create separate controller for each View and than connect them from interface builder, When you will add ViewController in side your project...you will find them inside a drop box next to class in below images. So just select view and than select a red cycled tab and than assign a view controller for that view :)

Visual

enter image description here

Same with other views,

enter image description here

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top