Cocoa Touch UIViewController Properties and class design -
I am creating a custom view controller This VC needs to load some data that is known in the event that It creates it and pushes it to the top of the navigation controller that it is going to be its share.
My question is, how should I pass data from a scene that handles the creation of a custom view controller in that custom view controller.
I have thought about four possible options, and I was hoping to get feedback on how well each person is or not for this functionality.
1) Reveal public properties in the Custom View Controller and - (zero) Set UI elements in the view based on those properties in ViewDidLoad.
2) Express the actual UI elements themselves and their .text / .image / Setting which create attributes as view controller.
3) Create a custom constructor for the custom view and pass those values that I need to set the UI elements
4) Create a custom model that both views Get access, set / push data before custom website is created, and access that data in the food stuffed event.
I am still new to do all this, and I have to make sure that I understand these handoffs of this data as proper management. It seems that something like this is probably a simple answer, but I am still a bit confused and it is probably important to correct this to avoid memory loss / leak.
In addition to this, if anyone cares, then I am using Stanford's CSL 3P class on iTunes U and Mark / Lamer's "iPhone Development" to enable me to understand Coco for iPhone Can go I am working on an application with Navigation Controller and one pair view controllers (presence 1 if you are familiar with 193P).
Well, I believe there are advantages; Damage to each of those methods based on your needs ... It will often require some combination of approach I believe that is the most common, for me to do something like this where you have to start it Can give enough.
MyViewController * vc = [[MyViewController alloc] init]; // (or initWithNibName: bundle :) // transfer VC value here vc.value1 = aValue; Vc.value2 = anotherValue; [Self. Navigation controller Push ViewController: animated vc: yes]; [VC Release];
Immediately after your Visual Controller you have an opportunity to pass items to it. Say that MyViewController is a detailed description, you want to give it to the object that will display this description. Or, if this is the table view, you can give it NSArray, it will need to be displayed. Then deedload in the scene or awake afroniab or awake from codder, or ... you can fill the scene ... to say.
Comments
Post a Comment