短暂的提示框 安卓效果(可以弹出自动消失的)

//短暂显示的提示框
-(void)shouNoticeViewWithNoticeString:(NSString*)noticeString{
UILabel * label =[[UILabel alloc]init];
label.font = [UIFont systemFontOfSize:12];
label.text = noticeString;
label.textAlignment = NSTextAlignmentCenter;
label.textColor = [UIColor whiteColor];
label.backgroundColor = [UIColor blackColor];
label.layer.cornerRadius = 8.0f;
label.layer.masksToBounds = YES;
label.numberOfLines = 2;
CGFloat labelW = 200;
CGFloat labelH = 60;
label.frame = CGRectMake((SCREENWIDTH - labelW)/2, (SCREENHEIGHT - labelH)/2, labelW, labelH);
[self.view addSubview:label];

[UIView animateWithDuration:2 animations:^{
    label.alpha = 0;
} completion:^(BOOL finished) {
    [label removeFromSuperview];
    [self ensureLogAgain];
}];

}

你可能感兴趣的:(短暂的提示框 安卓效果(可以弹出自动消失的))