bluetooth99 于 2013.01.21 11:29 提问
- 点击按钮修改文本尺寸
-
目前正在开发iphone应用,需要实现通过点击一个按钮,修改标签中的文本尺寸,不知道这种功能应该怎么实现?应该是在ios5中开发的。谢谢指教~~
-
- g989_1314125 2013.01.21 13:19
- 已采纳
创建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]];
}
应该可以实现你想要的效果 :)
-
- garaster 2013.01.21 11:38
CGRect frame = CGRectMake(0, 0, 400, 44);
UILabel *label = [[[UILabel alloc] initWithFrame:frame] autorelease];
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont boldSystemFontOfSize:8.0];
label.textAlignment = UITextAlignmentCenter;
label.textColor = [UIColor whiteColor];
label.text = @"Sample custom Title With small Fonts ";
self.navigationItem.titleView = label;
试试这个
-
- vikeyToy 2013.01.21 11:39
-(IBAction)changeFontOfLabel:(id)sender
{
[self.lebelObject setFont:[UIFont fontWithName:@"American Typewriter" size:18];
}
还有:注意写对字体名字。
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!