IOS UILabel 文字描边详解
来源:互联网 发布:会声会影x9激活软件 编辑:程序博客网 时间:2024/06/01 09:14
- (void)drawTextInRect:(CGRect)rect { CGSize shadowOffset = self.shadowOffset; UIColor *textColor = self.textColor; CGContextRef c = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(c, 1); CGContextSetLineJoin(c, kCGLineJoinRound); CGContextSetTextDrawingMode(c, kCGTextStroke); self.textColor = [UIColor whiteColor]; [super drawTextInRect:rect]; CGContextSetTextDrawingMode(c, kCGTextFill); self.textColor = textColor; self.shadowOffset = CGSizeMake(0, 0); [super drawTextInRect:rect]; self.shadowOffset = shadowOffset;}当然,如果你有更高的追求,更好的封装意识……
参考:https://developer.apple.com/library/mac/documentation/graphicsimaging/conceptual/drawingwithquartz2d/dq_text/dq_text.html#//apple_ref/doc/uid/TP30001066-CH213-TPXREF101
Use this mode
When you want to . . .
Example
kCGTextFill
Perform a fill operation on the text.
kCGTextStroke
Perform a stroke operation on the text.
kCGTextFillStroke
Perform both fill and stroke operations on the text.
kCGTextInvisible
Get text positions for the purpose of measuring text but not display the text. Note that the text position (x, y) is updated, as with all of the drawing modes.
kCGTextFillClip
Perform a fill operation, then add the text to the clipping area.
kCGTextStrokeClip
Perform a stroke operation, then add the text to the clipping area.
kCGTextFillStrokeClip
Perform both fill and stroke operations, then add the text to the clipping area.
kCGTextClip
Add the text to the clipping area, but do not draw the text.
- IOS UILabel 文字描边详解
- ios UILabel文字描边
- UILabel 文字描边详解
- [IOS 开发] UILabel文字描边
- iOS UILabel文字自动换行
- IOS UILabel 文字过长处理
- iOS UILabel 文字竖排显示
- iOS UILabel 加载 HTML文字
- iOS UILabel文字 左右缩进
- IOS--UILabel 用法详解
- UILabel详解iOS
- iOS UILabel详解
- iOS UILabel详解
- IOS--UILabel 用法详解
- IOS--UILabel 用法详解
- iOS UILabel详解1
- iOS UILabel详解
- IOS UILabel 详解
- Spring mvc + Spring Security 拦截 Restful格式的URL并进行验证,支持Remember me token数据库存储
- android pull解析器
- windows下绑定线程(进程)到指定的CPU核心
- 学习jQuery formValidator
- 三、创建 event_base
- IOS UILabel 文字描边详解
- 如何绘制precision——recall曲线和confusion矩阵
- 最小树形图
- (*)mongodb 安装及参数说明
- 最小生成树水题大合集
- Json字符串转List集合
- 用VC++实现应用程序窗口的任意分割(1)
- vc6.0中的dsp,dsw,ncb,opt,clw,plg,aps等文件的简单说明
- 窗体传值