Overriding properties of child view controller vs setting them via parent view controller
- by robinjam
If you want to modify the default behaviour of a View Controller by changing the value of one of its properties, is it considered better form to
instantiate the class and set its property directly, or
subclass it and override the property?
With the former it would become the parent View Controller's responsibility to configure its children, whereas with the latter the children would effectively configure themselves.
EDIT: Some more information:
The class I am referring to is FetchedTableViewController, a subclass of UITableViewController that I made to display the results of a Core Data fetch operation.
There are two places I want to display the results of a fetch, and they each have different fetch requests.
I'm trying to decide whether it's better to create a subclass for each one, and override the fetchRequest property, or make it the responsibility of the parent controller to set the fetchRequest property for its children.