一、給加上陰影uiimageview*pagecontenterimageview = [[uiimageview alloc]initwithimage:[uiimage imagenamed:@"
"]];
//新增邊框
calayer*layer =[pagecontenterimageview layer];
layer.bordercolor=[[uicolor whitecolor]cgcolor];
layer.borderwidth=0.0f
;
//新增四個邊陰影
pagecontenterimageview.layer.shadowcolor=[uicolor blackcolor].cgcolor;
pagecontenterimageview.layer.shadowoffset=cgsizemake(0,0
);
pagecontenterimageview.layer.shadowopacity=0.5
;
pagecontenterimageview.layer.shadowradius=5.0
;
//新增兩個邊陰影
= [uicolor blackcolor].cgcolor;
= cgsizemake(2, 2);
= 0.5;
= 2.0;
//-------------
陰影渲染會嚴重消耗記憶體 ,導致程式咔嘰.
/*陰影效果
*///
新增邊框
calayer*layer =[self.pagecontenter layer];
layer.bordercolor=[[uicolorwhitecolor]cgcolor];
layer.borderwidth=0.0f
;
//新增四個邊陰影
self.pagecontenter.layer.shadowcolor= [uicolorblackcolor].cgcolor;//
陰影顏色
self.pagecontenter.layer.shadowoffset=cgsizemake(0,0);//
陰影偏移
self.pagecontenter.layer.shadowopacity=0.5;//
陰影不透明度
self.pagecontenter.layer.shadowradius=5.0;//
陰影半徑
//新增兩個邊陰影
= [uicolor blackcolor].cgcolor;
= cgsizemake(2, 2);
= 0.5;
= 2.0;
二、給檢視加上陰影
uiview * content=[[uiview alloc] initwithframe:cgrectmake(100, 250, 503, 500
)];
content.backgroundcolor=[uicolor orangecolor];
content.layer.shadowoffset = cgsizemake(5, 3
); content.layer.shadowopacity = 0.6
; content.layer.shadowcolor =[uicolor blackcolor].cgcolor;
[self.window addsubview:content];
UImageview加邊框 加陰影
uiimageview imgvphoto uiimageview alloc init 新增邊框 calayer layer imgvphoto layer layer.bordercolor uicolor whitecolor cgcolor layer.borderwidth 5.0f 新增...
Flex中給物件加陰影的方法
flex 中給物件加陰影的方法 1 bordercontainer panel 等容器自帶陰影 bordercontainer 或者panel 等容器自帶了陰影,這通過dropshadowvisible 樣式設定,此樣式如果設為true 則顯示陰影。bordercontainer 的dropshad...
iOS 控制項加陰影
下面以給cell加陰影為例介紹加陰影的方法 self.contentview.backgroundcolor uicolor whitecolor self.contentview.layer.shadowcolor uicolor blackcolor cgcolor 陰影的角度,分別是靠右和靠下...