Reputation:
In my code i declare an @property
for my Main class in my sub class to set values there
@property(nonatomic,retain) MainViewController *father;
but i noticed that retain
make the dealloc
method not called in my main class, but when i change it to:
@property(strong, nonatomic) BabyViewController *father;
the dealloc
method returned to be called.
i did this without knowing if that effect my code performance or not.
i used this property
to do this in my main class:
subClass* controller = [[subClass alloc] initWithPageNumber:page];
controller.father=self;
[controller.view removeFromSuperview];
is this the best i can do ??
Upvotes: 3
Views: 143
Reputation: 5955
Better you can use assign
property for the declaration of viewControllers
and delegates
.It will assign the data and won't dealloc
the variable. So use like this,
@property(nonatomic,assign) MainViewController *father;
Upvotes: 3