您现在的位置: 万盛学电脑网 >> 程序编程 >> 网络编程 >> ios >> 正文

iOS中点击按钮修改文本的尺寸

作者:佚名    责任编辑:admin    更新时间:2022-06-22

 创建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];

点击UIButton时修改UILabel文本尺寸

-(IBAction)ButtonPressed:(id)sender
{
[self.lbl setFont:[UIFont fontWithName:@"Arial-BoldMT" size:25]];
}