Nativescript: background -image: url("res://..."); Not working in ios.

Created on 9 Aug 2017  路  8Comments  路  Source: NativeScript/NativeScript

I tried with following code ,build successfull but app not opening,In android it is working
background -image: url("res://...");

When i use use following code it is working in both platforms

background -image: url("~/images/bg.png")

Can any one tell us what wrong with the code

ios question

Most helpful comment

Yes - you can see this application for reference.

All 8 comments

@vijaykumarbollavaram what is the actual path passed in res://... and is there an image at this location in App_Resources/iOS folder. Keep in mind that if you pass something like

res://icon

the respective image should be located in

App_resources/iOS/icon.png

I have created this test project to demonstrate that setting the image as background-image works on both iOS and Android - please let me know if you need further assistance or if the issue is still reproduced at your side.

@NickIliev I have following folder struture

App _Resources
|-----Android
|-----ios------Assets.xcassets
                    |--------AppIcon.appiconset
                    |--------LaunchImage.launchimage
                    |--------LaunchScreen.AspectFill.imageset
                    |--------LaunchScreen.Center.imageset

I copied all android images in AppIcon.apiconset

Is this wrong

Assets.xcassets is a native folder for assets used for application icon and splash screen.

What you need is to have your images in the same logical structure for both iOS and Android
e.g.

App _Resources
|-----Android
    |----drawables-<resolution>
            |--------icon.png
|-----ios
            |--------icon.png

Now with res://icon you will be able to load the icon image on both iOS and Android.

But in my Android images I copied images in drawable-nodpi. I just used res:// it is working. Shall i copy images directly in App _Resources/ios/icon.png

Yes - you can see this application for reference.

Sorry for commenting already closed issue, but it is exactly what I try to implement.

I want to display the same image on the login page as on launch screen. So to prevent duplication of this image I want to load it from App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset.

Is it possible in NativeScript? I try to do it with ImageAsset and ImageSource classes but have not succeeded yet.

@ycherniavskyi no, you can not access the special folder Assets.xcassets/ - this is a folder meant specifically for the launch screen & images.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings