您的位置:首页 > 产品设计 > UI/UE

『iOS学习笔记』 UIButton-1

2012-05-18 16:49 561 查看
『iOS学习笔记』 UIButton-1

UIButton

/// UIButton

//创建UIButton
UIButton *tmpButton =[[[UIButton alloc] init]autorelease];

//设置背景颜色
tmpButton.backgroundColor = [UIColor blueColor];

//设置标题文本
[tmpButton setTitle:@"MyButton" forState:UIControlStateNormal];

//设置标题文本的颜色
[tmpButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];

//设置图片
UIImage *image3=[UIImage imageNamed:@"a3.png"];
[tmpButton setImage:image3 forState:UIControlStateNormal];

//设置位置和大小
tmpButton.frame = CGRectMake(0, 0, 200, 0);//在这里仅Width有效

//向容器中添加UIButton
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: