码迷,mamicode.com
首页 > 移动开发 > 详细

iOS常见设置

时间:2015-07-29 22:42:46      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:

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;//设置按钮内的小图片

-(voif)setBackgroundImag:(UIImage *)image forState:(UIControlState)state;//设置按钮的背景图片

设置按钮的文字字体 (需要拿到按钮内部的label来设置)

btn.titleLabel.font = [UIFont systemFontOfSize:12];

-(NSString *)titleForState:(UIControlState)state;//获得按钮的文字

-(UIColor *)titleColorForState:(UIControlState)state;//获得按钮多文字颜色

-(UIImage *)imageForState:(UIControlState)state;//获得按钮内部的小图片

-(UIImage *)backgroundImageForState:(UIControlState)state;//获得按钮的背景图片

 

iOS常见设置

标签:

原文地址:http://www.cnblogs.com/YTzZ/p/4687330.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!