去除button按鈕的邊框 iOS7appstore帶邊框的按鈕是怎么實(shí)現(xiàn)的?
iOS7appstore帶邊框的按鈕是怎么實(shí)現(xiàn)的?//初始化、設(shè)置文本、幀等。,省略//按鈕邊框?qū)挾葃ourButton.layer.borderWidth=1.5//設(shè)置圓角yourButton.l
iOS7appstore帶邊框的按鈕是怎么實(shí)現(xiàn)的?
//初始化、設(shè)置文本、幀等。,省略
//按鈕邊框?qū)挾葃ourButton.layer.borderWidth=1.5
//設(shè)置圓角yourButton.layer.cornerRadius=4.5
//將顏色空間設(shè)置為RGB以生成colorref
cgcolorspaceref colorspace=cgcolorspacecreatedevicergb()
//創(chuàng)建一個(gè)新的紅色colorref,用于設(shè)置邊框(四個(gè)數(shù)字是R,G,B,alpha)
]cgcolorref bordercolorref=cgcolorcreate(colorspace,(cgfloat[]){1,0,0,1})]//設(shè)置邊框顏色yourButton.start.layer. bordercolor=bordercolorref
此外,這里還有一個(gè)很好的例子可以推薦: