iOS7 UIStatusBar模糊不正确 [英] iOS7 UIStatusBar blur not correct

查看:175
本文介绍了iOS7 UIStatusBar模糊不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用UIToolbar作为屏幕顶部的控件(没有导航控制器)工具栏具有我想要的外观,但状态栏完全清晰。我似乎无法模仿UIToolbar在其透明度方面的模糊。有没有人遇到过不需要使用导航控制器的解决方案?

I am using a UIToolbar for the controls at the top of the screen (There is no navigation controller) The toolbar has the look I want, however the status bar is entirely clear. I cannot seem to mimic the blur that the UIToolbar has in it's transparency. Has anyone come across a solution to this that does not involve using a navigation controller?

推荐答案

为了实现这一目标,您需要在UIBarPositioningDelegate协议中实现方法:

In Order to achieve this you need to implement methods in the UIBarPositioningDelegate protocol:

https://developer.apple.com/library/ios/documentation/uikit/reference/UIBarPositioningDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/UIBarPositioningDelegate

以下是代码:

@interface ViewController : UIViewController <UIToolbarDelegate>

@property (nonatomic, weak) IBOutlet UIToolbar * toolbar;

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    //we become the delegate
    self.toolbar.delegate = self;
}

-(UIBarPosition)positionForBar:(id<UIBarPositioning>)bar{
    //this tells our bar to extend its background to the top.
    return UIBarPositionTopAttached;
}

@end

这篇关于iOS7 UIStatusBar模糊不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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