我想在 iPhone 底部显示一个状态栏,就像 Gmail 帐户中的状态栏一样,它似乎表明它正在检查邮件。我在此线程中尝试了以下解决方案 在 iPhone 中的 StatusBar 上添加视图
但是状态栏没有出现,然后我使用相同的代码没有任何修改将其显示在默认状态栏的顶部,它也没有出现。
我还尝试了另一种使用MTStatusBarOverlay的解决方案,当我尝试将其框架更改为底部时,我在屏幕中间看到了一个黑色矩形
有什么帮助吗?
这是代码
// new class i have created
@interface BottomStatusBarOverlay : UIWindow
@end
@implementation BottomStatusBarOverlay
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
// Place the window on the correct level and position
self.windowLevel = UIWindowLevelStatusBar+1.0f;
self.frame = [[UIApplication sharedApplication] statusBarFrame];
self.alpha = 1;
self.hidden = NO;
// Create an image view with an image to make it look like a status bar.
UIImageView *backgroundImageView = [[UIImageView alloc] initWithFrame:self.frame];
backgroundImageView.image = [[UIImage imageNamed:@"statusBarBackgroundGrey.png"] stretchableImageWithLeftCapWidth:2.0f topCapHeight:0.0f];
[self addSubview:backgroundImageView];
}
return self;
}
@end
// usage in my view controller in a button action
@implementation MainViewController
-(IBAction)showBottomStatusbar:(id)sender {
BottomStatusBarOverlay *bottomStatusBarOverlay = [[BottomStatusBarOverlay alloc] init];
bottomStatusBarOverlay.hidden = NO;
}