这是当初产品提出的要求,(中间小人要能动),找了一天的资料没找到,后来灵感爆发,想到图层这个东西,话不多说直接,直接上代码
_bottmImageview = [[UIImageView alloc]initWithFrame:CGRectMake(Screen_Width *0.05, Screen_Height *0.06, Screen_Width *0.9, Screen_Height *0.03)];
_bottmImageview.image = [UIImage imageNamed:@"jindutiao@2x"];
[self.contentView addSubview:_bottmImageview];//最下面灰色的图片
_upImageview = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, _bottmImageview.frame.size.width * 0.5, Screen_Height *0.03)];
_upImageview.image = [UIImage imageNamed:@"jindutiao2@2x"];
[_bottmImageview addSubview:_upImageview];//上面层绿色的图片
_tishiLable = [self createALabelWithframe:CGRectMake(0, 0, _upImageview.frame.size.width , Screen_Height *0.03) andWithName:@"" andTextAlcent:NSTextAlignmentCenter andTextColor:UIColorFromRGB(0xffffff) andFont:[UIFont systemFontOfSize:13]];
[_upImageview addSubview:_tishiLable];//中间text,这里面Lable的创建是我自己写的一个方法若果有需要,下篇博客贴出
_tishiImageview = [[UIImageView alloc]initWithFrame:CGRectMake(_upImageview.frame.size.width - Screen_Width *0.04, Screen_Height *0.05, Screen_Width *0.1, Screen_Height *0.05)];
_tishiImageview.image = [UIImage imageNamed:@"xiaoren@2x"];
[self.contentView addSubview:_tishiImageview];//这就是上面的小人图片(这里是写死的)若果想让他动很简单,利用帧动画
_RedFlagImageview = [[UIImageView alloc]initWithFrame:CGRectMake(Screen_Width * 0.93, Screen_Height *0.04, Screen_Width *0.03, Screen_Height *0.05)];
_RedFlagImageview.image = [UIImage imageNamed:@"qizi@2x"];
[self.contentView addSubview:_RedFlagImageview];//最后面的红旗标准
其实主要是思路,只要思路对了很多东西都能解决