本文主要是介绍UILable上添加一张图片,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
NSString *str2 =@"15";
UILabel *myLable = [self initWithFrame:CGRectMake(sizet.width+75, 6.0, 150.0, 20.0) context:@"" tectColor:[UIColor grayColor]];
UILabel *myLable1 = [self initWithFrame:CGRectMake(0.0, 2.0, 5.0, 15.0) context:@"[" tectColor:[UIColor grayColor]];
myLable1.font = [UIFont fontWithName:@"Thonburi-Bold" size:14.0f];
UIImageView *tempView = [[UIImageView alloc] initWithFrame:CGRectMake(5.0, 0.0, 20.0, 20.0)];
tempView.image = [UIImage imageNamed:@"xiangyu.png"];
UILabel *myLable2 = [self initWithFrame:CGRectMake(25.0, 0.0, 150.0, 20.0) context:[NSString stringWithFormat:@"相遇%@次]",str2] tectColor:[UIColor grayColor]];
myLable2.font = [UIFont fontWithName:@"Thonburi-Bold" size:14.0f];
[myLable addSubview:myLable1];
[myLable addSubview:tempView];
[tempView release];
[myLable addSubview:myLable2];
这篇关于UILable上添加一张图片的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!