Sportica   Sportica

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];

 

posted @ 2016-11-02 14:27  qingjoin  阅读(156)  评论(0编辑  收藏  举报
  Sportica