ios - Loading a UIImage from xcassets -
i'm trying load launch image image.xcassets folder no avail. there other answers (and this one) on purport answer main solution, load image so
uiimage *image = [uiimage imagenamed:@"default@2x"];
returns nil me.
the filename named correctly , project setup use assets.
does have idea how or doing wrong?
thanks in advance.
edit:
edit 2: final code:
-(void) loadsplashimage{ if ([self isipad]){ self.imageviewsplash.image = [uiimage imagenamed:@"default-portrait"]; } else{ if (self.view.frame.size.height == 480){ self.imageviewsplash.image = [uiimage imagenamed:@"default"]; } else if (self.view.frame.size.height == 568){ self.imageviewsplash.image = [uiimage imagenamed:@"default-568h"]; } else if (self.view.frame.size.height == 667){ self.imageviewsplash.image = [uiimage imagenamed:@"default-667h"]; } }
}
please note works portrait only.
you dont have specify size of image in name. automatically load size best fits device runs app. code should be.
uiimage *image = [uiimage imagenamed:@"default"];
where default name of resource xcassets
, 1 see on leftside list.
Comments
Post a Comment