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

ios 控件 UIButton

时间:2015-01-08 22:31:28      阅读:386      评论:0      收藏:0      [点我收藏+]

标签:


- (void)setTitle:(NSString *)title forState:(UIControlState)state; //设置标题
- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state; //设置标题颜色
- (void)setTitleShadowColor:(UIColor *)color forState: (UIControlState)state;//设置标题阴影
- (void)setImage:(UIImage *)image forState:(UIControlState)state; //设置图片
- (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state;//设置图片背景
 
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame = CGRectMake(100, 150, 60, 40);//设置按钮位置大小
[button setTitle:@"Normal" forState:UIControlStateNormal]; //设置常规下按钮的标题

 

[button setTitle:@"Highlight" forState:UIControlStateHighlighted]; //设置高亮状态下的标题
[button addTarget:self action:@selector(didButtonClicked) forControlEvents:UIControlEventTouchUpInside]; //设置按钮的点击事件

[self.view addSubview:button];//显示在页面上

 

 

ios 控件 UIButton

标签:

原文地址:http://www.cnblogs.com/daijiahong/p/4211929.html

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