Overview
- I have a iOS project in which the view controller implementation which has become large and thought it would be better to break into categories based on the functionality
- The outlets in the view controller implementation file are not available in the category’s implementation file.
Note – I am using ARC (automatic reference counting)
Question
- I have an outlet to the textfield created in my view controller’s implementation file. Now can I create another outlet to the same text field in my view controller category’s implementation file ?
- Would it cause any memory not be released or any other memory issues (Both the outlets are going to be
weakandnon atomic) ? - Is this acceptable from a design perspective or is there a better way to do it ?
- Can category’s methods be accessed in view controller’s implementation ? I can include the header file but I want to know if at runtime there would be any unpredictable behavior
If you need to access declared
IBOutletproperties in the categories of your view controller class, why not declare them in the class header file so that they are available to your categories? The ability to declare properties and ivars in implementation files now is meant to hide messy details of your implementation, but not at the risk of making your code unmanageable. Your functional design seems sensible.