1

Hi iam using following code for loading image to uiimageview its working when i loading that UIviewcontroller but if i open any other uiviewcontroller from the existing one and came back to the old uiviewcontroller and if i click a thumnail image its not not updating UIimageview uiviewcontroller.

img contains image path (inside device) in viewdidload

[self setBookimage:img];

in setBookimage()

- (void)setBookImage:(UIImage *)bookImage{

    book_cover_image.image=nil;
    book_cover_image.image = bookImage;
    CATransition *transition = [CATransition animation];
    transition.duration = 1.0f;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionFade;

    [book_cover_image.layer addAnimation:transition forKey:nil];
}

Thumbnail didselect methode code

   - (void)thumbnailListView:(ThumbnailListView*)thumbnailListView
             didSelectAtIndex:(NSInteger)index
    {

//filePathsofimages  contains 10 image paths

// The below code updating image if am loading the uiviewcontroller and clicking the thumbnails instead of opening another viewcontroller and coming back then clicking..

     img =[[UIImage alloc]initWithContentsOfFile:[filePathsofImages objectAtIndex:index]];
                [self setBookImage:img];
    }
4

2 回答 2

7

尝试:

[book_cover_image setNeedsDisplay];
于 2013-09-27T18:36:13.153 回答
0

你回来时检查过你的 var img 的内容吗?

也许那被重置了。

在 img var 中尝试 NSLog

于 2013-09-27T18:40:37.507 回答