drawInRect withAttributes在iOS8 GM上崩溃

时间:2014-09-11 08:59:03

标签: ios8 drawrect uigraphicscontext

UIGraphicsBeginPDFContextToFile(filePath, CGRectZero, nil);
UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, pageSize.width, pageSize.height), nil);
CGContextRef    ctx = UIGraphicsGetCurrentContext();

UIFont *bigFont = [UIFont systemFontOfSize:bigFontSize-2];
NSMutableParagraphStyle *paragraphStyleCenter = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
    paragraphStyleCenter.lineBreakMode = NSLineBreakByWordWrapping;
    paragraphStyleCenter.alignment = NSTextAlignmentCenter;
    NSDictionary *bigCenter = @{ NSFontAttributeName: bigFont,NSParagraphStyleAttributeName: paragraphStyleCenter };
CGRect renderingRect = CGRectMake(kMarginInset, kMarginInset -15, (pageSize.width - 2*kMarginInset), stringSize.height);


[tempS drawInRect:renderingRect withAttributes:bigCenter]; //Crash //tempS & renderingRect are valid

当我使用UIGraphicsBeginPDFContextToFile生成PDF时,这只会崩溃,

我对UIView使用相同的代码,它工作正常。

这适用于iOS7

0 个答案:

没有答案