在我的iPhone应用程序中。我想在单击按钮时更改标签中的文本大小
答案 0 :(得分:0)
以下是如何在运行时更改字体大小....
yourLabel.font=[UIFont systemFontOfSize:14];
答案 1 :(得分:0)
创建UILabel
self.lbl=[[UILabel alloc] initWithFrame:CGRectMake(135, 290,200,35)];
self.lbl.backgroundColor=[UIColor clearColor];
NSString *str=[NSString stringWithFormat:@"%.f",[self.slider value]];
[self.lbl setFont:[UIFont fontWithName:@"Arial-BoldMT" size:16]];
self.lbl.text=str;
[self.View addSubview:self.lbl];
点按UILabel
UIButton
的文字大小
-(IBAction)ButtonPressed:(id)sender
{
[self.lbl setFont:[UIFont fontWithName:@"Arial-BoldMT" size:25]];
}
这可能对您有所帮助:)
答案 2 :(得分:0)
-(IBAction)changeFontOfLabel:(id)sender
{
[self.lebelObject setFont:[UIFont fontWithName:@"American Typewriter" size:18];
}
并且还要写出正确的字体名称。点击此处查看fonts
列表