我需要使用一个线程才能从Web中检索图像并将其分配到图像视图中。NSOperation和SetImage
我有子类的NSOperation,并从我的视图控制器喜欢把它称为:
NSOperation *operation = [[[GetImage alloc] init] autorelease];
[queue addOperation:operation];
我得到图像细腻,但我怎么去分配是形象,是在我的NSOperation类?我有存储在一个UIImage称为RetrievedImage图像:
NSData *imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:url]];
retrievedImage = [[UIImage alloc] initWithData:imageData];
[imageData release];
我现在该如何获取到我的ViewController的ImageView的?
谢谢
我试图设置的ImageView setImage两个NSOperation类和ViewController类中,都没有工作。他们不会崩溃,只是没有任何反应。 – omniscian 2011-01-30 20:12:15
在将imageview添加到视图之前,您是否设置了此项?这应该是工作.... – Icky 2011-01-30 20:16:52