I need to do some UI tasks when user selects a UI tab item. Following delegate is available,
-(void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
Although, to answer for my particular question the internal UI transition issue is not important here, I am still sharing a overview code snippet.
-(void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
{
AppDelegate *delegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
[delegate.rootTabBarController showConsentErrorPage];
}
However, my UI task inside this delegate shows a glitch on the transition as it does the work after the tab is already shown. I want to perform the UI task first before the UI being visible. Any such delegate of trick to resolve this issue?
This may help you (without additional information, I can't really say).
UITabBarControllerconforming to<UITabBarControllerDelegate>UITabBarController, be sure to setself.delegate = self;inviewDidLoadshouldSelectViewControllerYES(i.e. allow the tab to be selected)NOHere is some sample code...
With this option, we present the "Ask Consent" controller, and only navigate to the "needs consent to see" tab when the user selects "Yes":
With this option, we present the "Ask Consent" controller and navigate to the "needs consent to see" tab behind it. If the user answers "No" we navigate back to the previously selected tab:
Note: This is Example Code Only and is not intended to be, nor should be considered, "production ready."