view的封装、UILabel的常见设置 UIButton的常见设置
来源:互联网 发布:淘宝卖家发货地怎么改 编辑:程序博客网 时间:2024/05/22 14:56
view的封装
如果一个view内部的子控件比较多,一般会考虑自定义一个view,把它内部子控件的创建屏蔽起来,不让外界关心
外界可以传入对应的模型数据给view,view拿到模型数据后给内部的子控件设置对应的数据
UILabel的常见设置
@property(nonatomic,copy) NSString *text;
显示的文字
@property(nonatomic,retain) UIFont *font;
字体
@property(nonatomic,retain) UIColor *textColor;
文字颜色
@property(nonatomic) NSTextAlignment textAlignment;
对齐模式(比如左对齐、居中对齐、右对齐)
UIFont代表字体,常见创建方法有以下几个:
+ (UIFont *)systemFontOfSize:(CGFloat)fontSize; 系统默认字体
+ (UIFont *)boldSystemFontOfSize:(CGFloat)fontSize; 粗体
+ (UIFont *)italicSystemFontOfSize:(CGFloat)fontSize; 斜体
UIButton的常见设置
- (void)setTitle:(NSString *)title forState:(UIControlState)state;
设置按钮的文字
- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state;
设置按钮的文字颜色
- (void)setImage:(UIImage *)image forState:(UIControlState)state;
设置按钮内部的小图片
- (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state;
设置按钮的背景图片
设置按钮的文字字体(需要拿到按钮内部的label来设置)
btn.titleLabel.font = [UIFont systemFontOfSize:13];
- (NSString *)titleForState:(UIControlState)state;
获得按钮的文字
- (UIColor *)titleColorForState:(UIControlState)state;
获得按钮的文字颜色
- (UIImage *)imageForState:(UIControlState)state;
获得按钮内部的小图片
- (UIImage *)backgroundImageForState:(UIControlState)state;
获得按钮的背景图片
- view的封装、UILabel的常见设置 UIButton的常见设置
- UIButton和UILabel的常见设置方法
- UIButton的常见设置
- OC笔记 - 模型对象、instancetype、xib的加载、UILabel、UIFont、UIButton的常见设置(2015.2.5)
- Xcode的常见设置
- IDEA的常见设置
- iOS中UILabel和UIButton的自定义设置
- iOS 使用storyboard设置UIButton 和UILabel 的圆角
- 常见邮箱的SMTP设置
- RTLabel常见的设置标签
- RTLabel常见的设置标签
- RTLabel常见的设置标签
- RTLabel常见的设置标签
- Android常见的系统设置
- 常见的Eclipse排版设置
- UILabel的AttributedString设置
- UILabel的所有设置
- 设置UILabel的内边距
- 内存管理算法--伙伴算法
- Doctrine-对象关系映射(ORM)中文版
- SDUT 2135----排队买饭(队列)
- USB接口无效(vmware usb device、unknown usb device)
- Eclipse 如何将Web项目的默认编译输出目录改为WEB-INF/classes?
- view的封装、UILabel的常见设置 UIButton的常见设置
- 【Splay|Treap】poj3580 SuperMemo && bzoj1503 [noi2004]郁闷的出纳员
- Java—hashCode与equals的区别与联系
- test
- 字典转模型
- pat1006 Sign In and Sign Out
- BIOS设置
- linux命令 mount
- [LeetCode] Best Time to Buy and Sell Stock IV