zoukankan      html  css  js  c++  java
  • IOS custom statusBar 思路

    /// show the custom statusBar
    //
    - (void)btn1:(id)sender
    {
        if(self.win && self.win.frame.origin.y == 0)
            return;
        
        if(self.win == nil)
        {
            self.win = [[UIWindow alloc] initWithFrame:CGRectMake(0, -20, 320, 20)];
            self.win.windowLevel = UIWindowLevelAlert;
            self.win.backgroundColor = [UIColor redColor];
        }
        [self.win makeKeyAndVisible];
        
        // show it with animation
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:.3];
        self.win.frame=CGRectMake(0,0,320,20);
        [UIView commitAnimations];
    }
    
    /// hide it:
    //
    - (void)btn2:(id)sender
    {
        if(self.win == nil || (self.win && self.win.frame.origin.y == -20))
            return;
        
        [UIUGetMainWindow() makeKeyAndVisible];// MainWindow: [[[UIApplication sharedApplication] windows] objectAtIndex:0].
        
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:.3];
        self.win.frame=CGRectMake(0,-20,320,20);
        [UIView commitAnimations];
    }
  • 相关阅读:
    单据存储过程
    C语言II博客作业04
    C语言II博客作业03
    C语言II博客作业02
    C语言II博客作业01
    学期总结
    C语言I博客作业09
    C语言I博客作业08
    C语言I博客作业07
    C语言I博客作业06
  • 原文地址:https://www.cnblogs.com/xiaouisme/p/3028595.html
Copyright © 2011-2022 走看看