Objects in interface

Posted by Peter Kowalchuk on Stack Overflow See other posts from Stack Overflow or by Peter Kowalchuk
Published on 2010-12-24T18:47:05Z Indexed on 2010/12/24 18:54 UTC
Read the original article Hit count: 304

Filed under:

I created my own object, PKSurvey. In the interface of the View Controller I can define a pointer to it, then in a method I can alloc it and have an instance. How do I keep the instance beyond the method where it was allocated? I assign values in one method and want to be able to use those values in other methods. Should I allocate it in the viewDidLoad method or should I do it somewhere else?

@interface DIrectionalDrillerViewController : UIViewController {

 PKSurvey *Survey=[PKSurvey new];


----------------

- (void)viewDidLoad {

 [Survey new];

© Stack Overflow or respective owner

Related posts about objective-c