Jump to a specific tab in a UITabBarController

前端 未结 2 935
旧巷少年郎
旧巷少年郎 2021-01-29 16:33

I want to jump to third tab in tabcontroller. I searched in Google but found nothing helpful.

If anybody can help I will be grateful.

2条回答
  •  天命终不由人
    2021-01-29 17:25

    Was the title/question changed? I thought the question was about Xcode...

    For what you're asking, try setting selectedIndex of your UITabBarController, like this:

    self.tabBarController.selectedIndex = indexOfTab;
    

    However don't overuse it, some automatic transitions between tabs can be considered as bad user experience.

    Don't just stop with this shortcut - learn more! Here's an extensive list of Xcode 4 shortcuts: print the B&W version, pin it your wall, learn and enjoy the Xcode even more.

提交回复
热议问题