How to set setSelectedIndex to UITabBarController to display our view controller which exists inside More View .
I tried to set index using following code
// To redirect user to home screen
TBDDashboardTabBarController *tabBar = segue.destinationViewController;
[tabBar setSelectedIndex:5];
But since only max of 5 tabs will be displayed by iOS and index is beyond visible tabs given indexed view controller is not being displayed.
If I set the setSelectedIndex as 0 to 3 like [tabBar setSelectedIndex:2];
it works great. Problem starts only if I try to set index greater than 3.
I tried in Google, stackoverflow and in other forums but no luck. The closest hint is How to get UIMoreListControllers child view controllers
Please help me to solve this riddle.
You can show the controller you need using selectedViewController
. Swift code:
destination.selectedViewController = destination.viewControllers![4]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.