2014年1月28日 星期二

layer設圓角、陰影畫黑框

sampleView.layer.cornerRadius = 10.5; // 圓角的弧度
sampleView.layer.masksToBounds = YES; //只留圓角內的背景,不加的話背景會超過圓角。
//它的意思是layer的效果只在laye的範圍內才有效,意思是如果你加了它,你設定的陰影效果就永遠不會出現。


//陰影畫黑框
self.closeButton.image = UIImage(named: PhotoNode.CLOSE_BUTTON_BG)
self.closeButton.layer.shadowRadius = 1.0
self.closeButton.layer.shadowOpacity = 1

self.closeButton.layer.shadowOffset = CGSizeZero

沒有留言:

張貼留言