绘制字符串(core graphic)

/*


 NSString  *str=@"凝望窗外,闲花淡淡,清凉而妩媚,寂静而安然。\n守着心里的那份安宁,淡然的行走在文字中,寻觅着你朦胧的身影,默默地解读着花的心语,细心典藏着你缱绻深情的笑意,枕着你的名字,浪漫而甜蜜,温馨而惬意!";

 

 

 

 //创建段落样式

 NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];

 //段落巨左

 paragraph.alignment = NSTextAlignmentLeft;

 //第一行缩紧20个点

 paragraph.firstLineHeadIndent=20.0;

 //行间距5个点

 paragraph.lineSpacing=5.0;

 //段落间距5个点

 paragraph.paragraphSpacing=5.0;

 //文字排版方向(默认左到右)

 paragraph.baseWritingDirection=0;

 //换行格式

 paragraph.lineBreakMode=NSLineBreakByWordWrapping;

 

 

 //NSFontAttributeName:字体

 //NSForegroundColorAttributeName:字体颜色

 //NSParagraphStyleAttributeName:paragraph:段落样式

 //NSStrikethroughStyleAttributeName:删除线

 //NSUnderlineStyleAttributeName:下划线

 //NSStrokeColorAttributeName:绘制字体颜色

 //NSStrokeWidthAttributeName:绘制字体宽度(空心效果)

 //NSExpansionAttributeName:扁平度

 //NSObliquenessAttributeName:倾斜度

 //NSVerticalGlyphFormAttributeName:排版方向(0:ios只有横拍)

 //NSShadowAttributeName:设置阴影

 [str drawInRect:CGRectMake(0, 100, 320, 200) withAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:30.0],NSStrokeColorAttributeName:[UIColor greenColor],NSStrokeWidthAttributeName:[NSNumber numberWithInt:10],NSForegroundColorAttributeName:[UIColor redColor],NSParagraphStyleAttributeName:paragraph,NSVerticalGlyphFormAttributeName:@0,NSStrikethroughStyleAttributeName:@(NSUnderlineStyleSingle),NSUnderlineStyleAttributeName:@(NSUnderlineStyleSingle)}];

*/


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值