ios - UITabBarControllerDelegate's method is not called -
i create programmatically uitabbarcontroller more 5 tabs (exactly 8 child view controllers).
my purpose custom transition animation tab changing. setup delegate uitabbarcontroller , implement method:
- (nullable id <uiviewcontrolleranimatedtransitioning>)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller animationcontrollerfortransitionfromviewcontroller:(uiviewcontroller *)fromvc toviewcontroller:(uiviewcontroller *)tovc
when select tab sending:
[tabbarcontroller setselectedindex: 6];
delegate's method not called.
delegate's method called when send
[tabbarcontroller setselectedindex: 3];
for example, i.e. visible tab.
one more remark: if selected view controller in visible range 0..3 , next view out of visible range 0..3 delegate's method still called. in case when selected view controller out of visible range 0..3 , next view out of visible range 0..3 delegate's method not called. , lose custom transition animation. problem.
i tried send
[tabbarcontroller setselectedviewcontroller: someviewcontroller];
instead of
[tabbarcontroller setselectedindex: 6];
it doesn't work.
you have many tabs use selectedindex
, other tabs in morenavigationcontroller
if morenavigationcontroller
not displayed on screen - meaning should return nsnotfound
when using selectedindex
.
you should use selectedviewcontroller
instead, per ios docs
[tabbarcontroller setselectedviewcontroller: yourindexsixviewcontroller];
wiki
Comments
Post a Comment