24 Jan 2013 5:08 PM #1
Answered: Stack depth in navigation view?
I've got a couple of views being pushed onto a navigation view. On the navigation bar, there's a text box that I'm using as a search field... I want this to be visible only when I'm at the lowest layer of the stack of views pushed onto the navigation view.
Currently, I'm hiding the text box when pushing a view to the navigation view, and catching the back button to unhide the text box. For a stack depth of 2, this works great. The problem is that I'd like to push more than one view to the navigation view, for a stack depth of 3, and have the text box only visible when stack depth = 1.
Is there any way to get the number of views that have been pushed onto another view? (or, failing that, a better way to handle this)
Thanks in advance for any information.
24 Jan 2013 5:47 PM #2
Alright well, once again, the act of typing it out was enough to spur a train of thought that got me to the answer.
If you want to find the stack depth of a view, check the length of the items array. So obvious. Feel silly for asking.
this.getMyView()._items.items.length (where myView a ref, of course)
25 Jan 2013 12:34 AM #3Code:
28 Jan 2013 1:13 PM #4
Yeah, I should probably be using the getter. :-\