UILabel How to set background image
2014-03-24 16:33 三戒1993 阅读(137) 评论(0) 编辑 收藏 举报UILabel *myLabel=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 20)]; UIImage *img = [UIImage imageNamed:@"a.png"]; CGSize imgSize = myLabel.frame.size; UIGraphicsBeginImageContext( imgSize ); [img drawInRect:CGRectMake(0,0,imgSize.width,imgSize.height)]; UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); myLabel.backgroundColor = [UIColor colorWithPatternImage:newImage];
版权声明:本文为博主原创文章,未经博主允许不得转载。