Overview
- I am doing an iOS project using the MVC architecture. Pardon my ignorance, I am just confused, I am looking for a good design.
- The view I am planning to use will have some buttons on it and some labels and text fields. My view wouldn't need any custom implementation of drawRect.
- All my logic as to what needs to be done when a button is pressed or event occurs is in my view controller
I have a couple of doubts:
for the above scenario, is it still better (good practice) to create a separate view (a view other than view controller's view) ? If so why ?
Other than drawing and displaying the view (in my project, I don't have much of it) what else should a view's implementation code contain ?
I would like to disable a set of buttons when the user touches on a textfield and the keyboard comes up.
a) So should I place this logic of disabling some buttons in the separate view's implementation (view created in question 1) ?
b) From my parent view (view created in question 1), can I create outlets to the buttons (which are subviews) to disable some of the buttons ? I am not able to do this. Or should I use the method
subviews
and loop through the button that i am looking for ?
My understanding
Model contains the data
View is responsible for displaying and shouldn't contain business logic.
- View controller is the only one to interact between the model and the view and contains the business logic