1

我想在 iPhone 的状态栏上添加一个按钮或自定义视图,

如果苹果不允许自定义状态栏,则可以添加任何按钮或查看状态栏...

有没有人对此有想法,请与我分享。

谢谢

4

1 回答 1

4

哟可以获得模仿 Reeders 状态栏覆盖的静态库,你可以在这里找到它

MTStatusBarOverlay

UIWindow或者只需使用以下覆盖创建一个简单的子类initWithFrame

@interface ACStatusBarOverlayWindow : UIWindow {
}
@end

@implementation ACStatusBarOverlayWindow
- (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];

        // 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];
        [backgroundImageView release];

        // TODO: Insert subviews (labels, imageViews, etc...)
    }
    return self;
}
@end

有关更多信息,请参阅此链接...

在 iphone 中添加查看状态栏

我希望这可以帮助你...

于 2012-12-17T09:57:48.370 回答