drawViewHierarchyInRect在Iphone6 plus上崩溃(Ios 8.2)

时间:2015-08-25 12:32:44

标签: ios iphone-6-plus uigraphicscontext

class func imageWithView(view : UIView) -> UIImage {
    println(view.bounds.size)
    UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0)
    view.drawViewHierarchyInRect(view.bounds, afterScreenUpdates: true)
    let img = UIGraphicsGetImageFromCurrentImageContext()
    UIGraphicsEndImageContext()
    return img
}

在Iphone6-Plus中运行此函数将导致“drawViewHierarchyInRect”上的EXC_BAD_ACCESS。在Iphone6-Plus模拟器中它捕获空图像。 但它在Iphone5 Iphone6上很好......

0 个答案:

没有答案