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.
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
Post a Comment