我想合併iOS中的多個UIImage。 要做到這一點,我想下面做:在iOS上合併多個UIImages
UIImage *imageLeft = [UIImage imageNamed:@"ico-left"];
UIImage *imageRight = [UIImage imageNamed:@"ico-right"];
CGSize size = CGSizeMake(imageLeft.size.width + imageRight.size.width, imageLeft.size.height);
UIGraphicsBeginImageContext(size);
[imageLeft drawInRect:CGRectMake(0, 0, imageLeft.size.width, imageLeft.size.height)];
[imageRight drawInRect:CGRectMake(imageLeft.size.width, 0, imageRight.size.width, imageRight.size.height)];
UIImage *finalImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, finalImage.size.width, finalImage.size.height)];
imageView.image = finalImage;
[cell.contentView addSubview:imageView];
但我不能得到任何圖像。我該如何解決它? 謝謝。
'的UIImage * imageLeft = [UIImage的imageNamed:@ 「ICO-left.png」];'或'的UIImage * imageLeft = [UIImage的imageNamed:@ 「ICO-left.jpg」];' – vikingosegundo
做什麼你的意思是'不能得到任何圖像'?調試時會發生什麼? – Wain