Objective C: How to add Shadow effect to navigation bar and table cells [duplicate]

主宰稳场 提交于 2019-11-29 01:30:27

问题


Possible Duplicate:
How to use Quartz 2D to add drop shadow to an UIImage or UIImageView ?

Hi,

I have created a tableViewController and want to try to add the shadow effect for both the navigation bar as well as the table cells. Can anyone guide me on the approach to do so?

Thanks!

Zhen Hoe


回答1:


try this

yourView.layer.shadowColor = [[UIColor blackColor] CGColor];
yourView.layer.shadowOffset = CGSizeMake(1.0f, 1.0f);
yourView.layer.shadowRadius = 3.0f;
yourView.layer.shadowOpacity = 1.0f; 

You'll need to replace "yourView" with nav bar or table cell

Btw, also you'll need import QuartzCore/CALayer.h



来源:https://stackoverflow.com/questions/6013137/objective-c-how-to-add-shadow-effect-to-navigation-bar-and-table-cells

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!