UINavigationBar.itents accessor does not return the current UINavigationItem

In my function, UINavigationBar: didPopItem:the navigation bar _itemStackhas n elements in it displayed in the debugger, but the accesser function .itemsreturns an array with n-1 elements in it, the absence of the current navigation element that I want to check. backItemreturns element n-2 instead of n-1, etc. The element didPopItemis an "n + 1" element, so that doesn't help either.

How do I access the current UINavigationItem?

I am using the iPhone 3.0 SDK.

+1
source share
2 answers

, "items" RunLoop. .

-(void)XXX:(UINavigationBar*)nBar {
    UINavigationItem *cItem = [nBar.items objectAtIndex:(nBar.items.count - 1)];
}

-(void)navigationBar:(UINavigationBar *)nBar didPopItem:(UINavigationItem *)item {
    [ self performSelector:@selector(XXX) withObject:nBar afterDelay:0 ];
}
+3

didPopItem , , , , !

shouldPopItem - .

. 3 , A, B C.

C, :

  • shouldPopItem [A, B, C]
  • C
  • didPopItem [A, B]

, , shouldPopItem, , didPopItem.

, ,

S

-1

All Articles