- (CGSize)drawInRect:(CGRect)rect withFont:(UIFont *)font lineBreakMode:(NSLineBreakMode)lineBreakMode alignment:(NSTextAlignment)alignment NS_DEPRECATED_IOS(2_0, 7_0, “Use -drawInRect:withAttributes:”) __TVOS_PROHIBITED;
iOS7之后不能使用此方法,要替换成新方法:
//iOS7 之前使用方法
[step drawInRect:CGRectMake(yStart, y - h / 2, self.yAxisLabelsWidth - 6, h) withFont:self.scaleFont lineBreakMode:NSLineBreakByClipping alignment:NSTextAlignmentRight];
//ios7以后使用一下方法替换
NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
paragraphStyle.lineBreakMode = NSLineBreakByClipping;
paragraphStyle.alignment = NSTextAlignmentRight;
NSDictionary*attribute = @{NSFontAttributeName:font,NSParagraphStyleAttributeName:paragraphStyle};
NSDictionary *attributes = @{NSFontAttributeName:self.scaleFont,
NSParagraphStyleAttributeName:paragraphStyle};
[step drawInRect:CGRectMake(yStart, y - h / 2, self.yAxisLabelsWidth - 6, h) withAttributes:attributes];
1228

被折叠的 条评论
为什么被折叠?



