1

I have a subclass of UIViewController, but I want it to have the property:

@proprty (nonatomic, strong) UIView *view

instead of the normal:

@property(nonatomic, retain) UIView * __null_unspecified view

which is defined in the UIViewController.h.

can I do that? if yes, then how? thank you.

5
  • do you want property of UIViewController Commented Sep 9, 2015 at 9:33
  • @property (strong, nonatomic) UIViewController *viewController; it then simply you can achive by this Commented Sep 9, 2015 at 9:35
  • @JagveerSingh i meant that i want to override the view property of UIViewController in the subclass, not create a new property
    – Nitzan R
    Commented Sep 9, 2015 at 9:43
  • if yuu made property in .h file then you can modified whenever you want Commented Sep 9, 2015 at 9:46
  • @NitzanR: What you want, could you please explain in detail.
    – Vineesh TP
    Commented Sep 9, 2015 at 10:26

1 Answer 1

0

override the method view: in your UIViewController subclass

-(UIView *)view
{

 UIView *customView= [super view];
[customView setSomething:something];
[customView addSubview:someView];
return  customView;
}

@proprty (nonatomic, strong) UIView *view

this will create getter and setter methods in UIViewController namely

-(UIView *)view; //getter
-(void)setView:(UIView *)view; //setter

have a look at this for more info.

Not the answer you're looking for? Browse other questions tagged or ask your own question.