views:

59

answers:

0

The code to set image to imageView is:

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    SDWebImageManager *manager = [SDWebImageManager sharedManager];
    UIImage *cachedImage = [manager imageWithURL:_url];

    if (cachedImage)
    {
        _imageView.image = cachedImage;
        [spinner stopAnimating];
    }
    else
    {
        [spinner startAnimating]; 
        [manager downloadWithURL:_url delegate:self];
    }

    // Configure the view for the selected state
    [super setSelected:selected animated:animated];
}


- (void)webImageManager:(SDWebImageManager *)imageManager 
     didFinishWithImage:(UIImage *)_image 
{
    [spinner stopAnimating];
    _imageView.image = _image;
    [self setNeedsLayout];
}

I use SDWebImage

this works every time in simulator, but when i run the app i device (Ipod touch) 80 % of the images is just black, but if i go to antoher view and back the images are set (from cache).

I have try to set delay on _imageView = _image, but change.

Any ides?

EDIT: Now I have try the code on a Iphone 3gs and it works perfect, can understand why it wont work on ipod touch.

EDIT 2: When i Compiled and Run as "Release" it works on ipod, but not in as debugger. Weard..