- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.backgroundColor = [UIColor clearColor];
if ([[UIDevice currentDevice].systemVersion floatValue] < 7.0f) {
self.textLabel.backgroundColor = [UIColor whiteColor];
}
_topUserNewName= [[UILabel alloc] init];
_topUserNewName.textAlignment = NSTextAlignmentLeft;
_topUserNewName.backgroundColor = [UIColor clearColor];
_topUserNewName.font = [UIFont fontWithName:@"HelvaticaNeue-Regular" size:5.0];
_topUserNewName.textColor = [UIColor colorWithRed:(47/255.0) green:(55/255.0) blue:(65/255.0) alpha:1];
_topUserNewName.frame = CGRectMake(66, 8, 215, 21);
_topUserName= [[UILabel alloc] init];
_topUserName.textAlignment = NSTextAlignmentLeft;
_topUserName.backgroundColor = [UIColor clearColor];
_topUserName.font = [UIFont fontWithName:@"HelvaticaNeue-Regular" size:10.0];
_topUserName.textColor = [UIColor colorWithRed:(145/255.0) green:(212/255.0) blue:(210/255.0) alpha:1];
_topUserName.frame = CGRectMake(66, 37, 210, 21);
[self.contentView addSubview:_topUserNewName];
[self.contentView addSubview:_topUserName];
self.selectionStyle = UITableViewCellSelectionStyleNone;
}
return self;
}
此代码在我的表格单元格类中。我想在这里以编程方式更改字体大小,当我更改大小时没有任何变化? 我在谷歌上研究过这条规则是正确的但没有任何想法?
最佳答案
名称 HelveticaNeue-Regular
实际上并不存在。这应该是 [UIFont fontWithName:@"HelvaticaNeue"size:10.0];
。
您可以在此处查看所有字体名称的列表:http://iosfonts.com/
关于iOS 以编程方式更改字体大小不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28648095/