是否可以从connectionDidFinishLoading使用UIGraphicsBeginImageContext?
执行下面的代码时出现这些错误:
[Switching to process 74682 thread 0x2003]
[Switching to process 74682 thread 0x207]
[Switching to process 74682 thread 0x720f]
-
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
UIImage = [[UIImage alloc] initWithData:self.resp_data;
CGSize itemSize = CGSizeMake(150);
UIGraphicsBeginImageContext(itemSize);
CGRect image_rect = CGRectMake(0.0,0.0,itemSize.width,itemSize.height);
[image drawInRect:image_rect];
self.image_view.image = UIGraphicsGetImageFromCurrentImageContext(); // image_view ivar is connected to a UIImageView in the View associated to this controller
self.resp_data = nil;
self.imageConnection = nil;
[image release];
}
知道可能是什么问题以及如何解决它吗? (当然,预期的图像没有显示)
谢谢您的帮助,
Stephane
I got these errors when the code below is executed:
[Switching to process 74682 thread 0x2003]
[Switching to process 74682 thread 0x207]
[Switching to process 74682 thread 0x720f]
--
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
UIImage = [[UIImage alloc] initWithData:self.resp_data;
CGSize itemSize = CGSizeMake(150);
UIGraphicsBeginImageContext(itemSize);
CGRect image_rect = CGRectMake(0.0,0.0,itemSize.width,itemSize.height);
[image drawInRect:image_rect];
self.image_view.image = UIGraphicsGetImageFromCurrentImageContext(); // image_view ivar is connected to a UIImageView in the View associated to this controller
self.resp_data = nil;
self.imageConnection = nil;
[image release];
}
Any idea what could be the issue and how to solve it ? (and of course the expected image does not show up)
Thx for helping,
Stephane
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
测试代码:100% 有效
TESTED CODE:100% WORKS