我遇到一个问题,如何在iphone sdk中显示.jpeg和其他类型的文件。对此有什么解决方案吗?请帮帮我。
谢谢你, Madan Mohan。
答案 0 :(得分:0)
创建一个像这样的UIImage:
UIImage *myImage = [UIImage imageNamed:@"image.jpeg"];
在UIImageView中显示:
UIImageView *myImageView = [[UIImageView alloc] initWithImage:myImage];
将UIImageView作为子视图添加到现有视图中:
[view adsdSubview:myImageView];
答案 1 :(得分:0)
您可以使用以下代码显示来自网址的图片
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];