I heard about the MVC architecture will use in iph开发者_JAVA百科onics applications and I wanna know what is usae of going for it and how it is helpful.
Anyone's help will be deeply appreciated.
The main usage of the MVC pattern is to enforce a separation between the data model, presentation layer, and business/controller logic in an application.
iPhone applications use it because Apple built the entire iPhone SDK around the MVC pattern. You don't strictly have to follow the MVC pattern when creating an iPhone application, but you will be fighting against the framework SDK the entire way if you choose to use a different design paradigm.
It's helpful because when used correctly it results in more readable and more maintainable code that is easier to refactor and restructure as time goes by.
You should watch session 116 from WWDC 2010:
"Model-View-Controller for iPhone OS"
You can find it here:
https://developer.apple.com/videos/wwdc/2010/
Another way to think about it...
Sticking with the MVC paradigm can make re-using your code easier, especially in circumstances where technology is changing swiftly enough that there are things like screen sizes and general appearance issues to fiddle with (i.e., new releases of an Apple mobile device). If you have an application that you'd like to make usable on both an iPad and and iPhone, your development pains will be fewer if all you only need to adjust controller and view code. If you can re-use the middle-tier model code, you'll have and easier time getting that app up and running for both devices.
And this doesn't just apply to iOS devices - you can think about things this way for web app development, as well.
精彩评论