想要用一张图片来设置为UILabel的背景,而UILabel中并没有background的这个属性或者方法时怎么办呢?
正确解决方法:
<span style="white-space:pre"> </span>UILabel *tip1Label = [[UILabel alloc]init];
tip1Label.frame = CGRectMake(0, 0, 240, 36.5);
tip1Label.textAlignment = NSTextAlignmentCenter;
tip1Label.text = @"请标记错题的科目";
tip1Label.font = [UIFont systemFontOfSize:14];
UIImage *bgimageori = [[UIImage alloc]init];
bgimageori = [UIImage imageNamed:@"Tips"];
UIEdgeInsets insets = UIEdgeInsetsMake(tip1Label.height-bgimageori.size.height, 0,0 , tip1Label.width-bgimageori.size.width);<pre name="code" class="objc"> <span style="white-space:pre"> </span>UIImageView *bg = [[UIImageView alloc] initWit