Is there a way to add images of type .jpeg , .gif and tiff... etc in iphone sdk?
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开发者_开发技巧.
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];
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];
精彩评论