错误代码:Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.
问题分析:iOS8在调用系统相机拍照时,会有一两秒的停顿,然后再弹出UIImagePickConroller,IOS7是没有这个问题的,在百度找了无数遍都没能解决这个问题,有说要将imagePickController设置为全局变量,有说要延时0.5秒再presentViewController的,各显神通,但很遗憾的都没能解决这个问题,今天特意单独写个Demo来研究此问题,终于取得了突破性的进展!
其实根本原因不在于系统拍照控制器上面,而是执行presentViewController这个动作本身!我们可以查看下UIViewController这个类,他有一个属性
1 | @property(nonatomic,assign) UIModalPresentationStyle modalPresentationStyle NS_AVAILABLE_IOS(3_2); |
[……]