i trying create custom tabbar animation when user taps on tab bar button.
i have implemented uitabbarcontroller subclass implements uitabbarcontrollerdelegate
here .m
#import "mycustomtabbarcontroler.h" @interface mycustomtabbarcontroler () @end @implementation mycustomtabbarcontroler - (void)viewdidload { [super viewdidload]; self.delegate = self; // set delegate self } #pragma mark - uitabbarcontrollerdelegate - (bool)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller shouldselectviewcontroller:(uiviewcontroller *)viewcontroller { //this called know delegate working nslog(@"the tabbarcontroller delegate set , working"); return yes; } //this delegate method never called - (id<uiviewcontrolleranimatedtransitioning>)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller uiviewcontrolleranimatedtransitioning:(uiviewcontroller *)fromvc toviewcontroller:(uiviewcontroller *)tovc { mybartransition *animator = [mybartransition new]; return animator; } //this delegate method never called - (id<uiviewcontrollerinteractivetransitioning>)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller interactioncontrollerforanimationcontroller:(id<uiviewcontrolleranimatedtransitioning>)animationcontroller { mybartransition *animator = [mybartransition new]; return animator; }
for reason delegate methods responsible transitioning not called. have read docs , can't see reason not called.
i have set delegate correctly , confirmed working implementing shouldselectviewcontroller method
what missing here?
i think using wrong delegate method trying accomplish. try using:
- (nullable id <uiviewcontrolleranimatedtransitioning>)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller animationcontrollerfortransitionfromviewcontroller:(uiviewcontroller *)fromvc toviewcontroller:(uiviewcontroller *)tovc;
this called when user taps on different tab.
Comments
Post a Comment