Re: Newbe trying to display images in a while loop
Re: Newbe trying to display images in a while loop
- Subject: Re: Newbe trying to display images in a while loop
- From: Wain <email@hidden>
- Date: Wed, 25 Jan 2006 21:42:07 +0000
Hi,
Your not telling the image view to redisplay each time you update the
image.
Even if you did, the loop will run so fast that you probably won't be
able to tell the difference anyway.
Why are you trying to display all of the images so quickly?
You should probably use a timer (NSTimer) and each time it fires set
a new image and tell the image view to redisplay.
Wain
On 25 Jan 2006, at 21:35, Terry Heaford wrote:
I am new to this cocoa lark and have been trying to display a
series of images in a custom ImageView.
A code snippet follows:
int startNum,endNum ;
int myNum = [libraryData currentImageNum];
int librarySize = [libraryData librarySize];
NSImage *image;
NSString *filePath;
NSLog(@"librarySize = %d",librarySize);
startNum = myNum;
endNum = librarySize-1;
while (startNum <= endNum)
{
filePath =[libraryData imagePathFromNum:startNum];
NSLog(@"thefilepath = %@",filePath);
image = [[NSImage alloc] initWithContentsOfFile: filePath];
[myImageView setOpacity:1.0];
[myImageView setImage:image];
[image release];
startNum++;
}
All the variables seem to initialise correctly but when it runs
through the loop it displays filePath in the log but only displays
the final image in myImageView.
I am unclear what I am doing wrong. Can someone help please.
TIA
Terry
___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden