tags:

views:

18

answers:

0

My code:

NSArray* fileTypes = [NSArray  arrayWithObjects: @"png",@"jpg",@"bmp",@"jpeg",@"gif",nil];      
NSOpenPanel* OpenImageDialog = [NSOpenPanel openPanel];
[OpenImageDialog setCanChooseFiles:YES];
if([OpenImageDialog runModalForDirectory:NSHomeDirectory() file:nil
                                            types:fileTypes] == NSOKButton)
{
    NSString * imageName = [OpenImageDialog filename];
    CGDataProviderRef provider = CGDataProviderCreateWithFilename([imageName UTF8String]);

    imageRef = CGImageCreateWithPNGDataProvider(provider, NULL, true, kCGRenderingIntentDefault);
    CGContextDrawImage(mWBContext, rect, imageRef);

it works perfect only when I open png files. But I want to open all files with extenshion specified in fileTypes array.

I really mesh with that..so can anyone help me......??