博客> iOS开发自定义状态栏(非常简单)
iOS开发自定义状态栏(非常简单)
2017-07-23 04:41 评论:0 阅读:115 3559741123
ios cell左滑 cell多个按钮

废话不多说我直接上代码


static UIWindow *window_;

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor redColor];
}

- (void)touchesBegan:(NSSet<UITouch> *)touches withEvent:(UIEvent *)event {
    window_.hidden = YES;
    window_ = [[UIWindow alloc] init];
    window_.backgroundColor = [UIColor blueColor];
    window_.frame = CGRectMake(0, -20, self.view.bounds.size.width, 20);
    window_.windowLevel = UIWindowLevelAlert;
    window_.hidden = NO;
    [UIView animateWithDuration:0.25 animations:^{
        window_.frame = CGRectMake(0, 0, self.view.bounds.size.width, 20);
    }];

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [UIView animateWithDuration:0.25 animations:^{
            window_.frame = CGRectMake(0, -20, self.view.bounds.size.width, 20);
        }completion:^(BOOL finished) {
            window_ = nil;
        }];
    });
}

@end

点击屏幕看看会发生什么?是不是很神奇,哈哈。

// 欢迎大家下载我的app:《咱们聊天吧》和《微文大杂烩》 ,上传你心目中女神照片,起上她的名字,平时不敢说的话都可以在这里发泄,还有各种段子,图片,文字游戏等等!,打造最强(wei)大(suo)人工智能,赶快下载看看吧. // /***/

收藏
0
sina weixin mail 回到顶部