字体设置

NSShadow *shadow = [[NSShadow alloc] init];
shadow.shadowColor = [UIColor blackColor];
shadow.shadowOffset = CGSizeMake(0, 1);
showed.shadowRadius = 5.0f;

(x, y) x代表向右偏移量,y代表向下偏移量

[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
    [UIColor blackColor],
    NSForegroundColorAttributeName,
    [UIFont fontWithName:@"HeitiSC" size:19.0],
    NSFontAttributeName,
    shadow,                                        
    NSShadowAttributeName,nil]];

设置文字颜色 NSForegroundColorAttributeName
设置字体 NSFontAttributeName
偏移用于文本阴影和文字阴影颜色 NSShadowAttributeName

  • 图层阴影是通过图层内容形状继承过来的,但是实时计算阴影很耗时,一般都会指定一个shadowPath来提高性能。
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容