views:

46

answers:

2

Hi guys,

I got one problem that how can i display the .jpeg and other type of files in iphone sdk. Is there any solution to this. please help me.

Thank you, Madan Mohan.

A: 

Create a UIImage like this:

UIImage *myImage = [UIImage imageNamed:@"image.jpeg"];

Display it in a UIImageView:

UIImageView *myImageView = [[UIImageView alloc] initWithImage:myImage];

And add the UIImageView as subview to your existing view:

[view adsdSubview:myImageView];
muffix
I have an image url like this : http://static.gamesradar.com/images/mb/GamesRadar/us/Games/X/X-Men%20Arcade/Bulk%20Viewer/360%20PS3/2010-10-11/192.168.30.167-image36_bmp_jpgcopy--game_thumbnail.jpg
Madan Mohan
A: 

you can use the following code to display image from the URL

NSData *imageData=[NSData dataWithContentsOfURL:[NSURL URLWithString:@"yourURL"]];

UIImageView *imgView=[[UIImageView alloc] initWithFrame:CGRectMake(100, 100, 250, 250)];
imgView.image=[UIImage imageWithData:imageData];
[self.view addSubview:imgView];
KingofHeaven