Re: cocoa-dev digest, Vol 1 #687 - 10 msgs
Re: cocoa-dev digest, Vol 1 #687 - 10 msgs
- Subject: Re: cocoa-dev digest, Vol 1 #687 - 10 msgs
- From: "John Tsombakos" <email@hidden>
- Date: Mon, 08 Oct 2001 08:47:09 -0400
Thanks for that. However, the application is based on
NSDocument and is letting it do the actual file opening and
such. It was working before I mucked with it, and I'm
looking for what to put (back) into the Document settings of
the Target panel to get it working again. It looks like it
should work (The "extension" is showing as 'jpg' and the
file type is showing as "????". I believe that's how it was
when I started.)
I might try the code you sent, I'm just not sure where it
would go (bit of a Cocoa newbie here...)
Thanks,
John T.
>
Subject: Re: Question about opening file
>
From: Chris Gehlker <email@hidden>
>
To: Cocoa DEV <email@hidden>
>
>
On 10/7/01 8:45 PM, "John Tsombakos" <email@hidden>
>
wrote:
>
>
> I'm playing around with a sample application that I
>
built, using
>
> instructions I found on the web (somewhere, I can't for
>
the life of me
>
> remember where!) It's a document based application that
>
just has an
>
> NSImageView in the window. You can open an image and it
>
gets displayed
>
> in the window. Simple enough.
>
>
>
> The tutorial told how to set up the files extensions in
>
the targets pane
>
> of the project to include jpg files. Today, I tried
>
changing it to be
>
> able to also open tiff files. I tried adding another
>
file type and
>
> rebuilt and ran. It would not let me select a tiff file
>
in the Open
>
> dialog. I tried removing the jpg selection and
>
rebuilding. I even did a
>
> clean and rebuild but could not open a tiff file. I
>
decided to try
>
> changing it back to jpg and cleaned and rebuilt. Now I
>
can't open either
>
> tiff or jpg!
>
>
Here is a little code fragment that will open any kind of
>
picture. Sorry
>
about the formatting:
>
>
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
>
result = [oPanel runModalForDirectory:[NSHomeDirectory()
>
stringByAppendingPathComponent:@"Pictures"]
>
file:nil types:[NSImage imageFileTypes]];
>
>
if (result == NSOKButton) {
>
myImage = [[NSImage alloc]
>
initByReferencingFile:[oPanel filename]];
>
...
>
>
>
The trick here is [NSImage imageFileTypes] which returns
>
an NSArray of every
>
type that QuickTime understands, or may understand in the
>
future. It rocks.
>
--
>
Many individuals have, like uncut diamonds, shining
>
qualities beneath a
>
rough exterior. - Juvenal, poet (c. 60-140)
>
>
--__--__--