why i change the alpha value of UIImageView but no effect?

Posted by chancy on Stack Overflow See other posts from Stack Overflow or by chancy
Published on 2012-12-15T04:51:43Z Indexed on 2012/12/15 5:03 UTC
Read the original article Hit count: 115

Filed under:
|
|

I am working on a reader app. when you read one magazine, it will display first five pages and download the rest pages one by one. there is a scrollview to view the thumbnail image of pages. At the beginning, if the page needs downloading, the corresponding thumbnail view's alpha value is set to 0.5. when the page is downloaded, i will update the thumbnail view's value to 1.0. I use one operation to download the page, and when one is downloaded i use delegate to set thumbnail view's alpha. But when i update thumbnail view's alpha value, it still the same as the beginning. it seems the alpha has no effect. I wonder is there anything wrong with my code? some snippets are as follows:

In the PageViewController.m

- (void)downloadPages
{
   DownloadOperation *op = [[DownloadOperation alloc] initWithMagazine:magazine];
   op.delegate = self;
   [[(AppDelegate *)[[UIApplication sharedApplication] delegate] sharedOperationQueue] addOperation:op];
}

- (void)downloadOperation:(DownloadOperation *)operation finishedAtIndex:(NSUInteger)index
{
   if (thumbScrollView){
      [thumbScrollView viewWithTag:THUMBVIEW_OFFSET+index].alpha = 1.0;
   }
}

In DownloadOperation.m

- (void)main
{
   // ...
   NSUInteger index = 0;
   for (Page *page in mMagazine.pages)
   {
       if (/*page doesn't exist*/){
           // download the page;
           if ([delegate respondsToSelector:@selector(downloadOperation:finishedAtIndex:)]) {
                        [delegate downloadOperation:self finishedAtIndex:index];
            }
       }
       index++;
   }
}

© Stack Overflow or respective owner

Related posts about ios

Related posts about uiview