button 的型別
typedef
ns_enum(nsinteger, uibuttontype) ;
六種定義button型別:
uibuttontypecustom = 0, 無型別
uibuttontyperoundedrect, 四個角是圓弧
型的
uibuttontypedetaildisclosure
uibuttontypeinfolight
uibuttontypeinfodark
uibuttontypecontactadd
uibuttontyperoundedrect 設定為這個屬性,是可以滿足我們普通情況下的按鈕圓角,當我們在button上新增背景和背景顏色的時候就會發現,這個屬性並不適用,因為現在的button已經不是圓角的了,它顯示的是的形狀,當設定背景顏色設定為uibuttontypecustom屬性才可以顯示出來。
所以我們需要用uibu
tton控制項的其它屬性來滿足我們的需求
jisuanbut
.backgroundcolor= [uicolor
redcolor];
jisuanbut
.layer.maskstobounds=
yes;
// 設定邊框的寬度
jisuanbut
.layer.borderwidth=
1.0;
// 設定邊框顏色
jisuanbut
.layer.bordercolor= [[uicolor
redcolor
] cgcolor
];
// 設定圓角半徑
jisuanbut
.layer.cornerradius=
8.0;
IOS 圓角設定
ios 系統自帶的 view 元件都是正方形的,看起來都太生硬,有時候我需要變成圓角形式,如下圖 具體的實現是使用quartzcore庫,下面我具體的描述一下實現過程 實現 標頭檔案 import import inte ce ipad webwiewviewcontroller uiviewcon...
iOS 設定圓角
uiimage image uiimage imagenamed 1 方式一 設定layer屬性 uiimageview imageview1 uiimageview alloc initwithframe cgrectmake 100,100,100,100 imageview1 setimage...
android中如何給button加圓角
分享一下我老師大神的人工智慧教程。零基礎!通俗易懂!風趣幽默!還帶黃段子!希望你也加入到我們人工智慧的隊伍中來!round corner bg.xml xmlns android android shape rectangle android color ff000000 android radiu...