iPhone:TabBar 重叠在 UIScrollView 上方
我已经以编程方式创建了一个 iPhone UI,但我只是不知道如何适应视图,以免它被 TabBar 重叠。这是所有权层次结构:
- AppDelegate
- UITabBarController
- UINavigationController x
- UITableViewController
- UIViewController(使用 XIB)
- UIScrollViewController(与父级位于同一 XIB 中)
- UIViewController(使用 XIB)
- UITableViewController
- UINavigationController x
问题是我的 TabBar 隐藏了 UIScrollView 的一部分(以及我的 tableview,但这并不重要)。我尝试操纵滚动视图内容大小和视图框架大小,但没有成功。
到目前为止,我能做的最好的事情就是在滚动视图的内容大小上添加 60px 的填充,如下所示:
[scrollView setContentSize:CGSizeMake(self.view.frame.size.width, self.view.frame.size.height+60)];
感谢您的帮助!
I have created an iPhone UI programmatically but I just can't figure out how to fit a view so that it doesn't get overlapped by the TabBar. Here's the ownership hierarchy:
- AppDelegate
- UITabBarController
- UINavigationController x
- UITableViewController
- UIViewController (with XIB)
- UIScrollViewController (in the same XIB as parent)
- UIViewController (with XIB)
- UITableViewController
- UINavigationController x
The problem is that my TabBar hides a part of my UIScrollView (and my tableviews as well, but that's not important). I tried manipulating the scrollview content size and the view frame size but with no luck.
So far the best I could do was to add a 60px padding on the scrollview's content size like this:
[scrollView setContentSize:CGSizeMake(self.view.frame.size.width, self.view.frame.size.height+60)];
Thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来你可能必须首先确保你的滚动视图的框架设置正确。 contentSize 将决定scrollView 内容的尺寸。换句话说,您可以在每个方向滚动多远。查看笔尖中的滚动视图,确保框架的大小适合您需要填充的尺寸。
Sounds like you may have to make sure your scrollView's frame is set properly first. The contentSize will determine the dimensions of the content of the scrollView. In other words how far you can scroll in each direction. Take a look at the scrollView in your nib and make sure the frame is the right size you need to fill.