开发者

UINavigationcontroller: Use a button to jump to other uiview from the tabbarcontroller

开发者 https://www.devze.com 2023-03-19 05:42 出处:网络
I havent tried this, yet. So is a kind of theoretical question. I have a tabbarcontroller, and in one view, let us call it \"stages\", i want to have a button that give you a shortc开发者_运维问答ut

I havent tried this, yet. So is a kind of theoretical question.

I have a tabbarcontroller, and in one view, let us call it "stages", i want to have a button that give you a shortc开发者_运维问答ut to the next tab bar item that is a mapview. In the mapview have I lot of annotations pins, that represent the position of several stages.

Resuming, I want a button in the stages view that jump directly to the annotation pin in the mapview in the next tabbar item.

Should I use like normally the [navigationcontroller pushcontroller: animated:] or exist other method to do it? In last case I will use normally push to another mapview.


If you want to directly jump to the other tab (you don't want a new viewcontroller in your navigationController, but want the other tab's VC), you can create a button or whatever that sets the selectedViewController property of your UITabBarController to the viewController in the other tab. (if your tabbarcontroller has constant tabs (they dont get changed)) you can do this by using the UITabBarController's viewControllers array. Something like this should work:

-(IBAction) jumpToMapTab:(id)sender {

    myTabBarController.selectedViewController = [[myTabBarController viewControllers] objectAtIndex:indexOfMyMapTab];

}

`

0

精彩评论

暂无评论...
验证码 换一张
取 消