I went back and reread most of chapter 4 today. It was a good idea as I did get more out of it. There are things that I simply have to know. One point worth noting is that if you need to do something, anything, with a control, then you need either an outlet or an action. For example, you have a text box. Well, text is entered into the view. That is all well and good. What is going to happen with the text? If it just sits there, then yes, there is nothing to do. I really can't think of any situation where you enter in text and do nothing with it. However, you will do some stuff with text but the text is not pushing anything. Therefore a text box is not really a source of an action unless, I assume you want to fire an event on exit. Not sure if this happens with Apple devices. I will assume not for now. So, what do you do with the text -- well, you need to use that value to do something else - maybe it will drive the program to perform something or simply, the data will get stored in a table somewhere. So, since it is not an action, it must be an outlet. You need to connect it to the controller class so then the code can in turn use it for something... and that is pretty much it.
Now if you have a button that is a different story. A button drives something. Therefore, a button is associated to an action. When clicked, the controller can then do something to something, perhaps, like a text box.
There is still a lot that needs to sink in. It is not so intuitive yet. Keep plugging away.
No comments:
Post a Comment