iOS:以编程方式设置UILabel的字体大小 [英] iOS: set font size of UILabel Programmatically

查看:1515
本文介绍了iOS:以编程方式设置UILabel的字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置UILabel的字体大小。无论我放什么价值,文字大小似乎都没有改变。这是我正在使用的代码。

I'm trying to set the font size of a UILabel. No matter what value I put though the text size doesn't seem to change. Here's the code I'm using.

[self setTitleLabel:[[UILabel alloc] initWithFrame:CGRectMake(320.0,0.0,428.0,50.0)]];
[[self contentView] addSubview:[self titleLabel]];
UIColor *titlebg = [UIColor clearColor];
[[self titleLabel] setBackgroundColor:titlebg];
[[self titleLabel] setTextColor:[UIColor blackColor]];
[[self titleLabel] setFont:[UIFont fontWithName:@"System" size:36]];


推荐答案

尝试 [UIFont systemFontOfSize: 36] [UIFont fontWithName:@HelveticaNeue尺寸:36]
[[self titleLabel ] setFont:[UIFont systemFontOfSize:36]];

这篇关于iOS:以编程方式设置UILabel的字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆