UIScrollView与UITabBarController截断 [英] UIScrollView is cut off from UITabBarController

查看:90
本文介绍了UIScrollView与UITabBarController截断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UIScrollView,我放在一个视图(界面构建器文档.xib / .m / .h)中,但是由于UITabBarController,UIScrollView的下半部分被剪切而没有显示自身的下半部分我有。

I have a UIScrollView that I place inside of a view (interface builder document .xib/.m/.h), however the lower portion of the UIScrollView is getting clipped and not showing the lower half of itself because of a UITabBarController I have.

我在appdelegate文件中实现了UITabBarController,所以在XIB中没有看到UITabBarController,但是如果我在XIB中放置另一个UITabBarController来模拟我已经创建的那个,当我测试应用程序时,我会得到两个。

I implemented the UITabBarController in the appdelegate file, so there is no UITabBarController that is seen in the XIB, however if I place another UITabBarController in the XIB to simulate the one i've already created, I will get two when I test the application.

这是视图外部的UIScrollView的快照。这将显示UIScrollView的下半部分...

Here is a snapshot of the UIScrollView outside of the view. This shows you the lower half of the UIScrollView...

http://b56.img-up.net/ScreenShotf7fc.png

以下是正在运行的应用程序的快照。请注意图片和笔记的下半部分是如何被切断的(只是勉强!)

Here is a snapshot of the application running. Notice how the bottom half of the picture and notes are being cut off (Just barely though!)

http://n22.img-up.net/ScreenShot2833.png

基本上 - > 如何显示滚动视图底部的其余部分? (图片/备注部分)没有被UITabBarController切断?

Basically--> How am I able to display the rest of the bottom of the scroll view? (picture/notes section) without it being cut off by the UITabBarController?

推荐答案

看看 ScrollView Docs 。如果您查看有关配置大小的部分,它会解释您应该设置conent insets,以便控制器不会切断内容。

Look at the ScrollView Docs. If you look at the section about configuring size it explains that you should set up conent insets so that controller's don't cut off the content.

似乎你需要设置底部的contentInset,例如:

Seems like you would need to set the bottom contentInset with something like:

scrollView.contentSize=CGSizeMake(320,758); // Or whatever your content size is
scrollView.contentInset=UIEdgeInsetsMake(64.0,0.0,44.0,0.0);
// 64.0 being the top inset, and 44.0 being the bottom inset
// Set the bottom inset to the height of your tab bar or more

这将确保您的标签栏不会被视图遮挡。

This will make sure your tab bar doesn't get obscured from your view.

这篇关于UIScrollView与UITabBarController截断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆