删除不需要的 ios7 填充

编程入门 行业动态 更新时间:2024-10-06 19:28:10
本文介绍了删除不需要的 ios7 填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

iOS7 为状态栏添加了内边距 (64px).因此,当使用 Scrollview 时,滚动视图和导航栏之间有一个很大的阵营.我试过了:

iOS7 adds padding (64px) for the status bar. Therefore when using a Scrollview there is a big camp between the scrollview and the navigation bar. I tried:

self.automaticallyAdjustsScrollViewInsets = NO;

这确实删除了不需要的填充 - 但是滚动视图不再滚动.

Which does remove the unwanted padding - however the scrollview no longer scrolls.

还有别的方法吗?

* 更新**

* update **

我发现了一个快速修复方法.我在故事板中排列了滚动视图和 y origin= 64px 而不是 0.我将滚动视图设置为 0px(然后导航栏覆盖了滚动视图的 64px),当我在模拟器上运行它时,它按照最初的意图对齐...有点黑客.不过,我正在寻找可靠的解决方案.

I discovered a quick fix. I was lining up the scrollview and y origin= 64px in the storyboard instead of 0. I put my scroll view to 0px (the navigation bar then covered 64px of my scrollview) and when I ran it on the simulator it was aligned as originally intend ... a bit of a hack tho. I'm looking for a solid solution however.

推荐答案

在您的视图控制器的 XIB/故事板上,确保取消选中调整滚动视图插入.您可能还需要取消选中Under Top BarsUnder Bottom Bars:

On your XIB/Storyboard for your view controller, make sure to uncheck the Adjust Scroll View Insets. You may also need to uncheck Under Top Bars and Under Bottom Bars:

这篇关于删除不需要的 ios7 填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-29 02:01:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1182579.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不需要

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!