Re: Managing navigation in an iOS app
Re: Managing navigation in an iOS app
- Subject: Re: Managing navigation in an iOS app
- From: Thomas Davie <email@hidden>
- Date: Wed, 22 May 2013 16:25:01 -0700
Hi James,
I'd suggest that you're probably pushing the idea of decoupling things a bit too far here.
View Controllers are inherantly tied to the behaviour of your application, and your user's experience of the flow through it. In 95% of cases, it's absolutely correct for the view controller to know "the user pushed this button, therefore I should show them this other view controller".
For the 5% of remaining cases where (for example) you have a highly reusable view controller that gets used in many different places in the app, and may push a different child VC depending on its usage location, I'd suggest simply using a delegate to that particular VC to allow you to separate out what gets pushed.
Thanks
Tom Davie
On 21 May 2013, at 20:56, email@hidden wrote:
> I'd like to get some opinions on handling navigation without having
> your view controllers modify the navigation stack directly.
> I'm currently working on an app where I've subclassed
> UINavigationController, which in turn has custom methods for showing
> the various views of the app. Each of my app's view controllers has no
> sense of the other pieces of the app, and do not push directly on the
> navigation controller. I'm thinking this a much better method since it
> decouples view controllers from each other and allows the flow of the
> app to be updated more easily.
> I'm using a lot of NSNotifications to signal commands to the
> navigation controller, and it's getting a bit messy. I love the idea
> of a centralized, decoupled navigation controller, but I haven't seen
> any good examples of this yet.
> I would love to get some feedback as to if this is a good idea in the
> first place, or techniques you've implemented to handle this sort of
> thing.
>
> Cheers,
>
> James
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden