> I read the excellent article 'Image Kit Programming Guide' at
> http://developer.apple.com/documentation/graphicsimaging/Conceptual/ImageKitProgrammingGuide/Introduction/chapter_1_section_1.html#//apple_ref/doc/uid/TP40004907-CH1-SW1
> and have my ImageBrowser working. I want to use it as the basis of an
> image-uploader and would like to visualize the upload-progress by
> removing the first image. I have connected a button to an IBAction and
> can remove the images one by one.
>
> I changed the 'if' to a 'while' but it doesn't animate removals one by
> one but is waiting with [mImageBrowser reloadData] until all images
> are removed (perhaps IBAction blocks it?) and remove all images at
> once.
>
> How can I make the [mImageBrowser reloadData] refresh within the while-loop?

Answering my own question! :-)

Another thread (regarding nstimer) put me on the right track. Reading
about nstimer suggested the use of nsthread, so wrapping the removal
of images into a thread solved my issue:

-(void)removeImages:(id)sender {
        while ( more images to remove ) {
                [mImages removeObjectAtIndex:0];
                [mImageBrowser reloadData];
                etc.
        }
}

- (IBAction)listImagesButtonClicked:(id)sender {
        NSThread *myThread = [[NSThread alloc] initWithTarget:self
selector:@selector(removeImages:) object:nil];
        [myThread start];
}

-- 
regards
Claus

When lenity and cruelty play for a kingdom,
the gentler gamester is the soonest winner.

Shakespeare
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to