应用程序框架在顶部留下空白行 [英] Application frame leaves blank line at the top

查看:146
本文介绍了应用程序框架在顶部留下空白行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我以编程方式定义的UIScrollView(使用应用程序框架)总是在20像素的顶部(在navigationBar下面)留下一个空白空间。我怎么能关闭它?

Any clues why my programmatically defined UIScrollView (using the application frame) always leaves an empty space at the top (below the navigationBar) of 20 pixels. How can I close that?

UIScrollView *vScrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
vScrollView.backgroundColor = [UIColor redColor];

我的屏幕如下所示:


  • 状态栏

  • - 导航栏

  • ---神秘的差距(10px?)

  • ----我的Scrollviewcontent(红色背景色)

  • status bar
  • -- Navigation bar
  • --- the mysterious gap (10px?)
  • ---- my Scrollviewcontent (with red background color)

我如何调用应用程序框架大小以避免这种差距?

How do I need to call the application frame size to avoid that gap?

推荐答案

我发现我使用错误的框架坐标applicationFrame。将它更改为边界时一切正常。

I found I use the wrong frame coordinates "applicationFrame". All works fine when changing it to the bounds.

UIScrollView *vScrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

这篇关于应用程序框架在顶部留下空白行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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