IOS开发:关于UILabel阴影设置的问题

来源:互联网 发布:matlab 矩阵符号运算 编辑:程序博客网 时间:2024/04/29 16:44

今天用了一下UILable的setShadowoffset方法,想通过此方法设置一下阴影,但是却发现没效果,代码如下:

UILabel *lab = [[UILabelalloc]initWithFrame:CGRectMake(350,450, 100, 30)];

lab.text = @"我的博客";

[labsetShadowOffset:CGSizeMake(5.8,5.8)]

结果没有任何效果,我就尝试设置了一下shadowColor属性,发现有效果了,于是查了一下官方文档,原来此属性默认为nil,哎,真笨啊我。。。抓狂

shadowColor

The shadow color of the text.

@property(nonatomic, retain) UIColor *shadowColor
Discussion

The default value for this property is nil,which indicates that no shadow is drawn. In addition to this property, you may also want to change the default shadow offset by modifying the shadowOffsetproperty. Text shadows are drawn with the specified offset and color and no blurring.