tags:

views:

30

answers:

1

Please guide me to write a code for iphone where i want to display the path of the browsed image along with the displaying that image?

+1  A: 

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.kitco.com/images/live/silverw.gif"]];
if([imageData length] == 0){
    /*NSString *imagePath = [[NSString alloc] initWithFormat:@"%@/%@",[[NSBundle mainBundle] resourcePath],@"no_image.png"];
     UIImage *image = [[UIImage alloc] initWithContentsOfFile:imagePath];
     [item setObject:image forKey:@"itemImage"];
     [imagePath release];
     [image release];*/
}
else {
    UIImage *image = [[UIImage alloc] initWithData:imageData];

    mChartImageView.frame = CGRectMake(0,0, 600, 300);
    myScrollView.contentSize = mChartImageView.frame.size;
    [myScrollView setMinimumZoomScale:-1.0];
    [myScrollView setMaximumZoomScale:4.0];
    [myScrollView setScrollEnabled:YES];
    [myScrollView setContentSize:CGSizeMake(mChartImageView.frame.size.width, mChartImageView.frame.size.height)];
    mChartImageView.image = image;  
    [image release];
}
[pool release];
GhostRider