uibutton的titlelabel 設定text屬性不能顯示,錯誤**:
uibutton *btnclear = [uibutton buttonwithtype:uibuttontypecustom];
btnclear.frame = cgrectmake(290 + offset, 273, 83, 35);
[btnclear setbackgroundimage:[uiimage imagenamed:@"sign_clear.png"] forstate:uicontrolstatenormal];
[btnclear setbackgroundimage:[uiimage imagenamed:@"sign_clear_hl.png"] forstate:uicontrolstatehighlighted];
btnclear.titlelabel.text = @"清除";
btnclear.titlelabel.textcolor = [uicolor greencolor];
原來,只有給tiltle設定值以後,才能夠利用titlelabel來修改顯示的文字,但在viewdidload函式不起作用,而且titlelabel的frame大小,也由初始化設定的文字的長短決定
所以用settitle:forstate 方法即可,最後**:
[btnclear settitle:@"清除" forstate:uicontrolstatenormal];
IOS介面開發之UIButton
測試uiimageview控制項 uibutton btnimageview uibutton buttonwithtype uibuttontypesystem btnimageview.frame cgrectmake 110,rect.size.height 40,150,30 btnimag...
IOS之UI 按鈕UIButton的細節
1 內部子控制項 2 按鈕拉伸問題 2 1 拉伸 2 2 無 拉伸 如果想要改變按鈕內部子控制項的屬性,只能自定義按鈕 內邊距 設定按鈕內容的內邊距 影響到imageview和titlelabel property nonatomic uiedgeinsets contentedgeinsets 設...
IOS之UI 按鈕UIButton的細節
1 內部子控制項 2 按鈕拉伸問題 2 1 拉伸 2 2 無 拉伸 如果想要改變按鈕內部子控制項的屬性,只能自定義按鈕 內邊距 設定按鈕內容的內邊距 影響到imageview和titlelabel property nonatomic uiedgeinsets contentedgeinsets 設...