drawInRect:withFont:lineBreakMode:alignment is deprecated

CGRect myRect = CGRectMake(5,10,200,100)

[myText drawInRect:myRect withFont:myFont lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentRight];
 
改写成:

NSMutableParagraphStyle *textStyle = [[NSMutableParagraphStyle defaultParagraphStyle]mutableCopy];

textStyle.lineBreakMode = NSLineBreakByWordWrapping;

textStyle.alignment = NSTextAlignmentRight;

NSDictionary *dictionary = @{NSFontAttributeName: self.percentageFont,NSParagraphStyleAttributeName: textStyle};

posted on 2015-02-22 10:32  奶杨  阅读(530)  评论(0编辑  收藏  举报

导航