Iphone 单击按钮时无法更改标签中的文本大小
在我的iphone应用程序中。我想在单击按钮时更改标签中的文本大小这里是如何在运行时更改字体大小Iphone 单击按钮时无法更改标签中的文本大小,iphone,ios,objective-c,ios5,uibutton,Iphone,Ios,Objective C,Ios5,Uibutton,在我的iphone应用程序中。我想在单击按钮时更改标签中的文本大小这里是如何在运行时更改字体大小 yourLabel.font=[UIFont systemFontOfSize:14]; 创建UILabel self.lbl=[[UILabel alloc] initWithFrame:CGRectMake(135, 290,200,35)]; self.lbl.backgroundColor=[UIColor clearColor]; NSString *str=[NSStr
yourLabel.font=[UIFont systemFontOfSize:14];
创建
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];
点击ui按钮时更改ui标签的文本大小
-(IBAction)ButtonPressed:(id)sender
{
[self.lbl setFont:[UIFont fontWithName:@"Arial-BoldMT" size:25]];
}
这可能对您有所帮助:)
并写出正确的字体名称。请在此处查看以下列表:
-(IBAction)changeFontOfLabel:(id)sender
{
[self.lebelObject setFont:[UIFont fontWithName:@"American Typewriter" size:18];
}