0
我收到了一個應用程序,我在這裏下載圖像。我這樣做:從url轉換爲uiimage時暫停
NSString *imgURL = [@"http://www.kwikspik.com/static/" stringByAppendingString:spikFromTopic.user_image];
NSData *imgData = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString:imgURL]];
UIImage *image = [[UIImage alloc] initWithData:imgData];
UIImageView *userImage =[[UIImageView alloc] initWithFrame:CGRectMake(20,size,userImageSize,userImageSize)];
userImage.image = image;
此代碼實現了很長時間。
互聯網連接問題?或者可能在我的代碼?
你是否嘗試加載圖像同步或在另一個線程?http://www.switchonthecode.com/tutorials/loading-images-asynchronously-on-iphone-using-nsinvocationoperation – pkyeck 2012-03-11 09:06:47