开发者

IOS Shared Application hide StatusBar

开发者 https://www.devze.com 2023-03-31 15:26 出处:网络
I am hiding the Status bar with the below code and it gives me a memory warning level1 . It does nothing to the app itself during the memory warning but I do not like to have such things happening. Is

I am hiding the Status bar with the below code and it gives me a memory warning level1 . It does nothing to the app itself during the memory warning but I do not like to have such things happening. Is there somthing I am doing wrong? or and con someone confirm a IOS bug? Not a huge deal just bothering me , so any info is greatly appreciated. Thanks!

[[UIApplication sharedApplication] setStatusBarHidden:YES   
withAnimation:U开发者_开发知识库IStatusBarAnimationSlide];


Try this

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
    { 
        if([[UIApplication sharedApplication] respondsToSelector:@selector(setStatusBarHidden:withAnimation:)]) {
                [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO]; 
            } 
            else { 
                id<UIApplicationDeprecatedMethods> app = [UIApplication sharedApplication];
                [app setStatusBarHidden:YES animated:NO];
            }
}

and declare in your .h

@protocol UIApplicationDeprecatedMethods
- (void)setStatusBarHidden:(BOOL)hidden animated:(BOOL)animated;
@end

Hope it helps..

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号