给 label 添加背景图片问题. 给 label. 添加背景图, 如果 text 为中文的话, 图文显示正常, 如果是英文的话, 文字就显示在图片下方, . 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 - (UIImageView *)backImg{ if (_backImg == nil) { _backImg = [[UIImageView alloc]initWithImage:BLImage(@"label_background_Image2")]; } return _backImg;}- (instancetype)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if (self) { self.textAlignment = NSTextAlignmentCenter; [self setTextColor:[UIColor whiteColor]]; self.font = [UIFont systemFontOfSize:10.0]; [self addSubview:self.backImg]; } return self;}- (void)layoutSubviews{ [super layoutSubviews]; [self.backImg mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.mas_equalTo(UIEdgeInsetsMake(0, 0, 0, 0)); }]; [self sendSubviewToBack:self.backImg];} cocos2d-x 2.x 触摸范围设置 关于如何构建udp数据包数据部分的问题 求助 如何让scrollview 自动滚动慢一点 菜鸟关于uitableviewcell的问题 ios仿微信录音 要推广企业的产品。除了做个网站之外。还可以开发些什么类型的应用? UILabel背景色的设定 关于ALAssetsGroup的问题 ios gcd 内存释放问题 iOS 游戏app的开发 求助,我不能打开iOS模拟器了 关于In-App Purchase的问题
- (UIImageView *)backImg{
if (_backImg == nil) {
_backImg = [[UIImageView alloc]initWithImage:BLImage(@"label_background_Image2")];
}
return _backImg;
}- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.textAlignment = NSTextAlignmentCenter;
[self setTextColor:[UIColor whiteColor]];
self.font = [UIFont systemFontOfSize:10.0];
[self addSubview:self.backImg];
}
return self;
}
- (void)layoutSubviews{
[super layoutSubviews];
[self.backImg mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(UIEdgeInsetsMake(0, 0, 0, 0));
}];
[self sendSubviewToBack:self.backImg];
}