目标C:如何将阴影效果添加到导航栏和表格单元格 [英] Objective C: How to add Shadow effect to navigation bar and table cells

查看:102
本文介绍了目标C:如何将阴影效果添加到导航栏和表格单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

如何使用Quartz 2D将阴影添加到UIImage或UIImageView?

我创建了一个tableViewController并想尝试为导航栏和表格单元格添加阴影效果。有人可以指导我这样做吗?

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?

谢谢!

Zhen Hoe

推荐答案

试试这个

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

您需要将yourView替换为导航栏或表格单元格

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

顺便说一下,你还需要导入QuartzCore / CALayer.h

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

这篇关于目标C:如何将阴影效果添加到导航栏和表格单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆