ios assign self to property in another class
I'm trying to assign self to a property in antoher class (nsobject class)
using self as pointer to the view controller but the property is always
nil. Any of you knows why or how can I fixed?
viewcontroller.m
-(void)startToDoSomething:(NSString*)testToRun
{
SecondClass *secondClass = [[SecondClass alloc] init];
secondClass.viewController = self;
[secondClass doSomething];
}
SecondClass.h:
NSObject classe:
.h file
#import "ViewController.h"
@class ViewController;
@interface SecondClass : NSObject
{
ViewController *viewController;
}
@property (nonatomic,retain) ViewController *viewController;
No comments:
Post a Comment