开发者

Is there a way to add images of type .jpeg , .gif and tiff... etc in iphone sdk?

开发者 https://www.devze.com 2023-01-20 09:54 出处:网络
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.

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];
0

精彩评论

暂无评论...
验证码 换一张
取 消