新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
iOS基于UILabel實現(xiàn)文字添加描邊功能
可以達到文字描一圈黑邊的效果:
網(wǎng)站設計制作、成都網(wǎng)站建設,成都做網(wǎng)站公司-創(chuàng)新互聯(lián)公司已向1000+企業(yè)提供了,網(wǎng)站設計,網(wǎng)站制作,網(wǎng)絡營銷等服務!設計與技術結合,多年網(wǎng)站推廣經驗,合理的價格為您打造企業(yè)品質網(wǎng)站。
繼承UILabel以后重載drawTextInRect:
- (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; }
總結
以上所述是小編給大家介紹的iOS基于 UILabel實現(xiàn)文字添加描邊功能,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對創(chuàng)新互聯(lián)網(wǎng)站的支持!
網(wǎng)站題目:iOS基于UILabel實現(xiàn)文字添加描邊功能
本文來源:http://fisionsoft.com.cn/article/gpeghd.html