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

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

作者: 一笑wangx | 来源:发表于2017-12-08 10:05 被阅读14次

//短暂显示的提示框
-(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];
}];

}

相关文章

网友评论

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

      本文链接:https://www.haomeiwen.com/subject/toosixtx.html