Possible Duplicate:
Objective C — narrow instance variable types in subclasses?
I have a class called ParentClass which has a UIView property. I also have a class called ChildClass which is a subclass of ParentClass. ChildClass obviously inherits the UIView property, but in ChildClass I know for certain I’ll only be using a UIScrollView for this property.
My question is, is it possible / feasible to somehow “subclass” the UIView property, rename it, and make it so it can only be a UIScrollView? Would I have to override the property in the .m file when I synthesize?
Similar to how a UITableViewController‘s main view property is a UITableView rather than a UIView as in UIViewController.
UPDATE: Maybe I just didn’t mean property, but also the variable itself.
Just add a property with the same name to your child class but with UIScrollView instead of
UIView.