gpt4 book ai didi

iphone - iOS7 UIStatusBar 模糊不正确

转载 作者:可可西里 更新时间:2023-11-01 04:39:31 25 4
gpt4 key购买 nike

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

Scroll content behind status bar

Scroll no content behind status bar

最佳答案

UIBarPosition demo

为了实现这一点,您需要在 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

关于iphone - iOS7 UIStatusBar 模糊不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18920703/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com