iOS 渐变提示。Labe自动换行

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

    noticeLabel.text = @"当前账号已失效果,已清除当前账号已失效果,已清除当前账号已失效果,已清除当前账号已失效果,已清除当前账号已失效果,已清除当前账号已失效果,已清除";

    noticeLabel.frame = CGRectMake(0, 400, 300, 60);

    noticeLabel.textColor = [UIColor whiteColor];

    [self.view addSubview:noticeLabel];

    noticeLabel.backgroundColor = [UIColor grayColor];

    

    noticeLabel.numberOfLines = 0;//表示label可以多行显示

    noticeLabel.lineBreakMode = NSLineBreakByClipping;

    CGSize size = [noticeLabel sizeThatFits:CGSizeMake(noticeLabel.frame.size.width, MAXFLOAT)];

    noticeLabel.frame =CGRectMake(10, 400, 300, size.height);

    

    

    [UIView beginAnimations:nil context:nil];

    [UIView setAnimationCurve:UIViewAnimationCurveEaseIn];

    [UIView setAnimationDuration:4.0];

    [UIView setAnimationDelegate:self];

    noticeLabel.alpha = 0.0;

    [UIView commitAnimations];

原文地址:https://www.cnblogs.com/qingjoin/p/6022811.html