ios - CALayerInvalidGeometry CALayer bounds contains NaN: [0 0
问题描述
将 UIview 渲染为图像时应用程序崩溃 将视图渲染为图像的代码
- (UIImage*)imageOfSelf
{
UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, 0);
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *imageOfSelf = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return imageOfSelf;
}
收到此错误
CALayer bounds contains NaN: [0 0; 1.25987e-321 nan]. Layer: <CALayer:0x2834f8580; position = CGPoint (0 0); bounds = CGRect (0 0; 0 0); delegate = <UIView: 0x10d425820; frame = (0 0; 0 0); layer = <CALayer: 0x2834f8580>>; allowsGroupOpacity = YES; >
类似的问题已经存在,但这并不能解决我的问题
解决方案
推荐阅读
- scipy-optimize - 使用 scipy.optimize.linprog 解决 LP 问题并检索画面
- javascript - 在 HTML5 画布中绘制一系列矩形以完全填满画布
- c++ - C++构造函数和析构函数设置双向链表
- javascript - 我的 Jquery Transit 不工作,我该怎么办
- php - 身份验证后如何更改仪表板字段?laravel-8
- python - 熊猫将文本文件转换为 CSV
- ionic-framework - IONIC 日历周视图在周之间自动滚动,没有任何事件
- variables - Stata:用另一个变量的值更改变量的名称
- shortcode - WP Shortcode 不适用于已注销的用户
- nullreferenceexception - 如何在 C# autocad 中修复 System.NullReferenceException