jpg images in iphone and 2x images

前端 未结 5 1810
傲寒
傲寒 2021-02-04 01:33

I am working on an iphone app and targeting iOS 4.0 or later. I am trying to add an image to UIImageView, and image is in jpeg format. This i

5条回答
  •  遥遥无期
    2021-02-04 02:12

    You can use jpgs, just tried it myself and it worked. Only suggestion is how you are instantiating it. Try it this way:

    stockImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"Morbo.jpg"]];
    
    stockImage.frame = CGRectMake(0,0, self.view.bounds.size.width, self.view.bounds.size.height)  ;
    
    [self.view addSubview:stockImage];
    

    This is the image I used:

    http://futurama.wikia.com/wiki/File:Morbo.jpg

提交回复
热议问题