I want to restrict some property from the exisiting class of the components.
Here is the sample code,
UIButton *customBtn;
property (nonatomic, strong) UIButton *customBtn;
@synthesize customBtn;
this my implementation,
customBtn= [UIButton buttonWithType:UIButtonTypeCustom];
customBtn= setImage:[UIImage imageNamed"radio_button_noraml.png"] forState:UIControlStateNormal];
customBtn= setImage:[UIImage imageNamed"radio_button_acitve.png"] forState:UIControlStateSelected];
customBtn = CGRectMake(5, 30, 20, 20); notsupport = [[UILabel alloc]initWithFrame:CGRectMake(25, 30, 290, 20)];
[customBtn addTargetelf actionselector(MyAction:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:customBtn];
In my view controller, i could access all the property in the UIbutton using the customBtn.
myClass.customBtn.backGroundcolor = [UIColor blackColor];
But i want to restrict the access of the button properties,For eg.i want to access the propertybackground color and alpha value, rest of the property i don't want to access.
so please help me out.
Thanks!
In objective-c all methods are public, and property are nothing but setter and getter (methods).
So you can't restrict existing methods/properties.
And even if you subclass it you can only override it.
There you can add an NSAssert if anyone uses that method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With