开发者

Is there another way than presentModalViewController to show a UITabBarController on just part of the screen?

I have a UITabBarController displaying a number of settings-screens in my app. I want them to be shown on just a part of the screen for layout reasons. In fullscreen, the lists become unreadable (too wide), there are just a few controls per page making the page feel very empty, and the tabbar buttons are far away from the content (Fitts law).

Using presentModalViewController with the UIModalPresentationFormSheet style gives me the size I want. I do this on top of an empty background, since in my case it doesn't make sense to display anything behind it. The "real" working area is displayed with another presentModalViewController in fullscreen mode on top of it all.

This works but feels like a ha开发者_如何学Gock. One problem is, I can't make the background behind the settings dialog move in the transition to fullscreen with the UIModalTransitionStyleFlipHorizontal style.

TL;DR

Can I embed a UITabBarController non-fullscreen in another "background"-view? I can't find any information of how I would do this.


Can I embed a UITabBarController non-fullscreen in another "background"-view? I can't find any information of how I would do this.

Why don't you try it out?

  1. Create a container view of the size you want the tab bar controller to have.
  2. Create the tab bar controller.
  3. [containerView addSubview:tabBarController.view];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜