iOS之用uilabel弹出消息提示框

UILabel *cover = [[UILabel alloc] init];

    cover.frame = CGRectMake(0, 0, 150, 30);

    cover.center = CGPointMake(self.view.frame.size.width * 0.5, self.view.frame.size.height * 0.5);

    cover.font = [UIFont systemFontOfSize:12];

    cover.text = [NSString stringWithFormat:@"成功安装%@", app.name];

    cover.textColor = [UIColor whiteColor];

    cover.textAlignment = NSTextAlignmentCenter;

    cover.backgroundColor = [UIColor blackColor];

    cover.alpha = 0.0;

    cover.clipsToBounds = YES;

    cover.layer.cornerRadius = 5;

    [self.view addSubview:cover];

    

    [UIView animateWithDuration:0.5 animations:^{

        cover.alpha = 0.5;

    } completion:^(BOOL finished) {

        [UIView animateWithDuration:0.5 delay:0.5 options:UIViewAnimationOptionCurveEaseInOut animations:^{

            cover.alpha = 0.0;

        } completion:^(BOOL finished) {

            [cover removeFromSuperview];

        }];

    }];

posted on 2014-10-23 15:41  林源  阅读(367)  评论(0编辑  收藏  举报

导航