On 02 May 2015, at 20:18, William Squires <[email protected]> wrote: > This is sort of in response to the thread, "Parent/child view controllers: > when shall we use it?". > > Since, in both iOS and Mac OS X, a control IS a view, why don't controls have > their own dedicated view controllers? i.e. If I make a new single-view iOS > project, and I put a UILabel in the main view, why doesn't Xcode generate a > template view controller (code) for the UILabel (that is, > UILabelViewController), just like there's a view controller for the main view > (usu. ViewController.h and ViewController.m, or - in swift, just > ViewController.swift)? > > I'm guessing this is because they're built in to the frameworks?
I think you're unclear about the Model-View-Controller (or more descriptively Model-Controller-View) pattern. View and model classes are intended to be re-usable bits that you set up your application from. Controllers are your application-specific code that glues your re-usable application bits together. Usually, you have one controller for an entire (sub-)hierarchy of view or model classes. (NB -- views being by concept re-usable doesn't mean you'll actually re-use them. Just that that is the design goal behind them and how you want to separate the layers) -- Uli _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
