uibutton字体大小
来源:互联网 发布:快速排序的算法 编辑:程序博客网 时间:2024/05/01 06:01
btn.frame = CGRectMake(x, y, width, height);
[btn setTitle: @"search" forState: UIControlStateNormal];
//设置按钮上的自体的大小
//[btn setFont: [UIFont systemFontSize: 14.0]]; //这种可以用来设置字体的大小,但是可能会在将来的SDK版本中去除改方法
//应该使用
btn.titleLabel.font = [UIFont systemFontOfSize: 14.0];
[btn seBackgroundColor: [UIColor blueColor]];
//最后将按钮加入到指定视图superView
[superView addSubview: btn];
附:创建按钮的两种方法:
1、动态创建
btnfont = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[btnfont setFrame:CGRectMake(100, 10, 120, 40)];
[btnfont addTarget:self action:nil forControlEvents:UIControlEventTouchUpInside];
[btnfont setTitle:@"字体" forState:UIControlStateNormal];
btnfont.backgroundColor=[UIColor clearColor];
[self.view addSubview:btnfont];
2、在xib文件中已经创建好,通过tag获取按钮
UIButton *testButton= (UIButton*)[self.view viewWithTag:100];
[testButton addTarget:self action:@selector(test:) forControlEvents:UIControlEventTouchUpInside];
注册事件
-(void) test: (id) sender{
UIAlertView *av = [[[UIAlertView alloc] initWithTitle:@"ceshi" message:@"test11111" delegate:nil cancelButtonTitle:@"OK"otherButtonTitles:nil] autorelease];
[av show];
}
- uibutton字体大小
- 设置UIButton字体大小
- UIButton调整字体大小
- UIbutton UIlabel字体大小自适应
- 如何修改UIButton的字体大小和颜色
- 在IOS程序中设置UIButton的字体大小
- 在IOS程序中设置UIButton的字体大小
- iOS _ UIButton 标题字体大小颜色位置等
- 字体大小
- 字体大小
- 字体大小
- 字体大小
- iOS设置改变UILabel、UIButton的多种颜色和字体大小(非常好用)
- UIButton
- UIButton
- UIButton
- uibutton
- UIButton
- (leetcode)Word Break
- 从ViewController初始化一直谈到强制横屏
- 从零开始学Python
- 【杂七杂八】Eclipse中打包Android工程生成apk
- VC++中Format函数详解
- uibutton字体大小
- 快速转换True和False标志
- 高并发热点/单点数据_性能问题解决方案
- 企业最需职业排行榜第一位——数据分析师
- 火车车厢重排问题
- 第二套17
- SAE下的MEMCACHE使用方法
- 黑马程序员(指针)
- Objective-c 代理模式(delegate)