开发者

Loading multiple images in sequence on iPad

I'm working on an application that talks home to a server and retrieves some data with image URL's embedded in it. I want to display those images on the view, and am getting them like so:

UIImageView *ivAvatar = [[UIImageView alloc] initWithImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:self.avatarUrl]]]];
[self.view addSubview:ivAvatar];
[ivAvatar release];

However, whenever data is retrieved (for example, on startup of the application), there is a delay between the retrieval of the data and开发者_开发技巧 the user being able to interact with the application due to the blocking nature of dataWithContentsofURL.

What is the proper way to do "Asynchronous" downloading of images? I need the UI to be responsive and load all other data that is retrieved, but load the images while allowing the UI to be responsive.

Any suggestions?


NSURL, NSURLRequest, and NSURLConnection.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜