当我调用UIAlertView的dismissWithClickedButtonIndex:animated:时,我遇到了一个问题,其中9次出现问题,委托方法alertView:willDismissWithButtonIndex:未被调用.还有其他人遇到这个问题吗?我即将向Apple提交一个错误,但我很想知道是否有其他人遇到过这个问题,并想出任何解决方法.
我正在使用以下内容从UIView生成UIImage
UIGraphicsBeginImageContextWithOptions(view.frame.size, YES, [[UIScreen mainScreen] scale]);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage* img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Run Code Online (Sandbox Code Playgroud)
通常工作,但大约一半的时间,我调用renderInContext时出现此错误:
<Error>: CGContextDrawImage: invalid context 0x84d0b20
Run Code Online (Sandbox Code Playgroud)
有没有人知道为什么会发生这种情况或如何检测它何时发生?如果上下文的地址是0x0,我想我会感觉更好,因为它至少是我可以测试和处理的东西,但到目前为止,这让我感到难过.
编辑:哎呀.意思是使用view.frame.size而不是view.bounds.size.