按鈕方法示例代碼

接着前篇的按鈕控件方法的實現

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];


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章