JNYJ

JNYJ - IOS - DEV

 

异步下载 NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://%@", self.adLogoUrl]];

 

    if(self.adLogoUrl)

    {

        dispatch_queue_t queue_t = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);

        dispatch_async(queue_t, ^{

            [CommonFuncs doLogForTemp:@"url:(%@)",self.adLogoUrl];

            NSURL *url = [NSURLURLWithString:[NSStringstringWithFormat:@"http://%@", self.adLogoUrl]];

            UIImage *image = [UIImageimageWithData:[NSDatadataWithContentsOfURL:url]];

            [CommonFuncs doLogForTemp:@"image:(%@)",image];

            if (image) 

            {

                dispatch_sync(dispatch_get_main_queue(), ^{

                    //

                    [self.adImageView setImage:image];

                    [self.adImageView setNeedsLayout];

                });

            }

        });

    }

posted on 2012-02-23 12:56  JNYJ  阅读(1020)  评论(0编辑  收藏  举报

导航