Hi,
I download the image Kit browser sample from the apple site, which works very well. I added the Nib files and classes to my existing application.
I have the nib and controller.
I added one function:
The standard code which uses a button works like this:
In My app I call the this function using this:
But it never loads the images, but it does find the images which I specify. (NSLog displays them) But they are never loaded into the browser. But the browser works when clicking on the image.
I am sure it is something simple, but I don't normally deal with more than one class file, they seem to complicate things...
You can download the image browser sample here:
http://developer.apple.com/samplecode/ImageBrowserView/listing14.html
Chris
I download the image Kit browser sample from the apple site, which works very well. I added the Nib files and classes to my existing application.
I have the nib and controller.
I added one function:
Code:
- (void)addImages:(NSArray *)path
{
if (path)
{
NSLog(@"%@ Path...",path);
// launch import in an independent thread
[NSThread detachNewThreadSelector:@selector(addImagesWithPaths:) toTarget:self withObject:path];
}
[imageBrowser setNeedsDisplay:YES];
}
The standard code which uses a button works like this:
Code:
- (IBAction)addImageButtonClicked:(id)sender
{
NSArray* path = openFiles();
if (path)
{
// launch import in an independent thread
[NSThread detachNewThreadSelector:@selector(addImagesWithPaths:) toTarget:self withObject:path];
}
}
In My app I call the this function using this:
Code:
ImageBrowserController *imageBrowser = [[ImageBrowserController alloc] init];
// LOAD IMAGE BROWSER NIB FILE
if (![NSBundle loadNibNamed:@"imageBrowser" owner:self])
{
NSLog(@"Warning! Could not load myNib file.\n");
} else {
NSArray *new = [NSArray arrayWithObject:path];
[imageBrowser addImages:new];
}
But it never loads the images, but it does find the images which I specify. (NSLog displays them) But they are never loaded into the browser. But the browser works when clicking on the image.
I am sure it is something simple, but I don't normally deal with more than one class file, they seem to complicate things...
You can download the image browser sample here:
http://developer.apple.com/samplecode/ImageBrowserView/listing14.html
Chris