萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> ios >> iOS中點擊按鈕修改文本的尺寸

iOS中點擊按鈕修改文本的尺寸

 創建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]];
}

copyright © 萬盛學電腦網 all rights reserved