UILabel 设置圆角

UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake((ScreenWidth - 245)*0.5, 178, 245, 164)];

    label.layer.cornerRadius = 13.0;

  label.text = @"恭喜你,密码修改成功";

    label.textAlignment = NSTextAlignmentCenter;

    label.backgroundColor = [UIColor whiteColor];

    [label setFont:[UIFont systemFontOfSize:18]];

这样直接设置圆角半径是不可以的,需要另行设置    label.clipsToBounds = YES;

posted @ 2016-10-19 11:47  hayde  阅读(624)  评论(0)    收藏  举报