首页 > 其他 > 详细

电池栏上弹窗

时间:2014-07-29 12:44:16      阅读:339      评论:0      收藏:0      [点我收藏+]

//可以不被电池栏挡住

+ (UILabel *)alertLabel

{

    

    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 20.f, 320.f, 0.f)];

    label.backgroundColor = [UIColor colorWithRed:240.f/255.f green:224.f/255.f blue:149.f/255.f alpha:1.0];

    label.textAlignment = NSTextAlignmentCenter;

    label.font = [UIFont systemFontOfSize:14];

    [[self alertWindow] addSubview:label];

    return label;

}

 

+ (void)alertHeadMessage:(NSString *)message

{

    CGFloat alertHeight = 30.f;

    __weak UIWindow *window = [self alertWindow];

 

    __weak UILabel *label = [self alertLabel];

    label.text = message;

    

    label.frame = CGRectMake(0, -30.f, window.frame.size.width, alertHeight);

    [UIView animateWithDuration:0.5f animations:^{

        label.frame = CGRectMake(0, 0.f, window.frame.size.width, alertHeight);

    } completion:^(BOOL finished) {

        [UIView animateWithDuration:2.5f animations:^{

            label.frame = CGRectMake(0, 0.f, window.frame.size.width, alertHeight + 2);

        } completion:^(BOOL finished) {

            [UIView animateWithDuration:0.4 animations:^{

                label.frame = CGRectMake(0, -30.f, window.frame.size.width, alertHeight);

            } completion:^(BOOL finished) {

                [label removeFromSuperview];

            }];

        }];

    }];

    [window makeKeyAndVisible];

}

 

电池栏上弹窗,布布扣,bubuko.com

电池栏上弹窗

原文:http://www.cnblogs.com/ldc529/p/3874842.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!