iOS7中的状态栏重叠内容 [英] statusbar overlapping content in iOS7

查看:21
本文介绍了iOS7中的状态栏重叠内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 iOS7 中,我放置在状态栏正下方的工具栏已与状态栏合并

With iOS7 the toolbar I placed right under the statusbar has merged with the statusbar

但是当我将工具栏向下移动 20px 时,它看起来像

but when I move the toolbar 20px down, then it looks like

我怎样才能有第一张图片的效果(状态栏与工具栏颜色相同)但不与状态栏合并.或者这应该在 iOS7 中做不同的事情?

How can I have the effect of the first picture (statusbar with same color as toolbar) but not merging it with the statusbar. Or should this be done differently in iOS7?

推荐答案

将自己设置为工具栏代表.然后在你的视图控制器中,实现 UIBarPositioningDelegate.实现如下:

Set yourself as the toolbar delegate. Then in your view controller, implement UIBarPositioningDelegate. Implement it as follows:

目标 C

- (UIBarPosition)positionForBar:(id <UIBarPositioning>)bar {
    return UIBarPositionTopAttached;
}

迅捷

func positionForBar(bar: UIBarPositioning) -> UIBarPosition {
  return .TopAttached
}

还要确保将工具栏向下移动 20 点(就像您已经做过的那样),或移动到状态栏的正下方,以实现此效果.

Also make sure you move your toolbar 20 points down (as you already did), or right underneath the status bar, for this effect to take place.

这篇关于iOS7中的状态栏重叠内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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