iphone - 在 UITableViewCell 中设置图像时,出现 <Error> : CGAffineTransformInvert: singular matrix

标签 iphone ios ios5

我正在使用存储在核心数据中的 Person 对象填充 UITableView。每个人都有名字、姓氏和图像。图像是与单独的图像实体的关系,该实体具有称为可转换类型数据的属性。这是我存储与每个人相关的图像的地方。

我正在用以下内容填充表格:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"PersonCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    // Configure the cell...
    Person *person = [self.fetchedResultsController objectAtIndexPath:indexPath];

    NSMutableString *nameString = [[NSMutableString alloc] init];

    if (person.firstName)
    {
        [nameString appendString:[NSString stringWithFormat:@"%@ ",person.firstName]];
    }
    if (person.lastName)
    {
        [nameString appendString:person.lastName];
    }

    cell.textLabel.text = nameString;

    UIImage *image = person.image.data;
    cell.imageView.image = image;

    return cell;
}

当我运行我的应用程序时,出现错误:

: CGAffineTransformInvert: 奇异矩阵。

表或数据库中的每个项目一次。

如果我注释掉这一行:

cell.imageView.image = image;

错误消失了。

有什么想法吗?这是我第一次在 Core Data 中存储二进制数据,也许它没有转换吧?

这就是我存储图像的方式:

UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
self.person = [Person personWithImage:image inManagedObjectContext:self.context];

+ (Person *)personWithImage: (UIImage *)image inManagedObjectContext:(NSManagedObjectContext *)context
{
    Image *newImage = [NSEntityDescription insertNewObjectForEntityForName:@"Image" inManagedObjectContext:context];
    newImage.data = image;

    Person *newPerson = [NSEntityDescription insertNewObjectForEntityForName:@"Person"
                                                    inManagedObjectContext:context];
    newPerson.image = newImage;

    return newPerson;
}

谢谢,

格里

最佳答案

好吧,我很幸运地解决了这个问题。我的 uitableview 使用单元格中的图像,我将全尺寸相机图像放在那里,当然遇到了一些内存问题。一旦我开始将图像调整为 960x640,随机的 CGAffineTransformInvert 错误就消失了!

我仍然不知道它为什么会发生,但我想这并不重要,因为它现在已经消失了。

关于iphone - 在 UITableViewCell 中设置图像时,出现 <Error> : CGAffineTransformInvert: singular matrix,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11455214/

相关文章:

iphone - 我如何知道是否应该继续支持 OS 4.3 等?

iphone - 可以使用两个单独的 SQLite 数据库吗?

ios - 如何重用属性

iphone - 在 iOS 应用程序中获取全局 IP 地址和国家/地区是否合法?

iphone - Sqlite3 数据库在运行 iOS 5.0.1 的 iPhone 4 中未在 Wi-Fi 和蜂窝网络上连接

iphone - MKMapView 中的 zoomLevel 和 mapCenter

ios - 无法在 'parameters' 错误中分配给 'self' - 来自 CS193p 斯坦福在线类(class)

ios - Firebase - 知道应用程序重启后数据何时保存到服务器

ios5 - 命令/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang 失败,退出代码为 1

ios - TWTweetComposeViewController 不显示链接预览