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:

screenshot of assets folder

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

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -