您的位置:首页 > 编程语言

按钮方法示例代码

2013-10-17 11:19 176 查看
接着前篇的按钮控件方法的实现

1.UIButton * button =[UIButton
buttonwithType:UIButtonTypeRoundRect];  
 //圆角

2.button.frame=CGRectMake(坐标x,坐标y,按钮长度w,按钮高度h);
  //位置设定

3.[Button SetTitle:@"按钮"
 forState:UIControlStateNormal];
   //正常状态

4.[Button SetTitle:@"按钮按下"
 forState:UIControlStateHighligted];
  //高亮状态

5.[button addTarget:self
 action:@"selector"(buttonAction)
 forControlEvents:UIControlEventTouchUpinside];

6.[button setTitleColor
:[UIColor blackColor]
 forState:UIControlStateNomal];

7.button.titlelabel.font:[UIfont
 systemfontofsize:14];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: