ios - didSelectViewController behaviour when re clicking/tapping on the active tab bar item -


the documentation says didselectviewcontroller method of uitabbarcontrollerdelegate called when re-clicking on selected item.

https://developer.apple.com/library/ios/documentation/uikit/reference/uitabbarcontrollerdelegate_protocol/index.html#//apple_ref/occ/intfm/uitabbarcontrollerdelegate/tabbarcontroller:didselectviewcontroller:

in ios v3.0 , later, tab bar controller calls method regardless of whether selected view controller changed. in addition, called in response user taps in tab bar , not called when code changes tab bar contents programmatically.

but according tests, it's not (testing on ios9), method called when active view controller changed. doing wrong ? there way detect tap on active tab bar item ?

ok, reason method didselectviewcontroller not called when same selected view controller, had other delegate method implemented :

- (bool)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller shouldselectviewcontroller:(uiviewcontroller *)viewcontroller {     return (viewcontroller != tabbarcontroller.selectedviewcontroller); } 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -