UIButton和UILabel的宽与高
2016-07-04 17:31
423 查看
UIButton:
1、UIButton对于自定义Button需要设置宽度和高度才能显示,
2、而系统的Button在系统内部设置了宽度高度所以不需要认再去设置,如果人为改变其大小,显示的imageView大小是没有变化,只是Button的大小发生了改变
3、代码如下:
UIButton*button = [UIButton
buttonWithType:UIButtonTypeContactAdd];
button.frame =
CGRectMake(100,
100, 100, 100);
button.backgroundColor = [UIColor
redColor];
[self.view
addSubview:button];
NSLog(@"%@",NSStringFromCGRect(button.frame));
UILabel:
1、UILabel
需要设置宽度和高度才能显示
UILabel *lalel = [[UILabel
alloc] initWithFrame:CGRectMake(100,
100, 100,
100)];
lalel.backgroundColor = [UIColor
redColor];
[self.view
addSubview:lalel];
NSLog(@"%@",NSStringFromCGRect(lalel.frame));
1、UIButton对于自定义Button需要设置宽度和高度才能显示,
2、而系统的Button在系统内部设置了宽度高度所以不需要认再去设置,如果人为改变其大小,显示的imageView大小是没有变化,只是Button的大小发生了改变
3、代码如下:
UIButton*button = [UIButton
buttonWithType:UIButtonTypeContactAdd];
button.frame =
CGRectMake(100,
100, 100, 100);
button.backgroundColor = [UIColor
redColor];
[self.view
addSubview:button];
NSLog(@"%@",NSStringFromCGRect(button.frame));
UILabel:
1、UILabel
需要设置宽度和高度才能显示
UILabel *lalel = [[UILabel
alloc] initWithFrame:CGRectMake(100,
100, 100,
100)];
lalel.backgroundColor = [UIColor
redColor];
[self.view
addSubview:lalel];
NSLog(@"%@",NSStringFromCGRect(lalel.frame));
相关文章推荐
- iOS App中UILabel的自定义及在Auto Layout中的使用
- 详解iOS中UIButton的三大UIEdgeInsets属性用法
- iOS App开发中修改UILabel默认字体的方法
- iOS - UIButton(UIEdgeInsets)/设置button上的文字和图片上下垂直居中对齐
- Swift之贪婪的UIButton
- UIButton拖动响应事件,距离问题
- IOS 7.1 兼容性bug 问题,UIButton,UILabel ...
- UIKit框架(18)UIButton和UITextField
- UILabel的学习
- UILabel显示HTML
- UIButton小结
- UILabel
- iOS控件--UILabel
- iOS控件--UIButton
- ULabel显示1.n行文字特效,特效
- UIButton扩大响应区域
- [Swift]UIKit学习之UILabel的用法
- [Swift]UIKit学习之UIButton的用法
- UIKit,UIView
- UILabel 的NSTextAlignment扩展