Link xcode images.xcassets on local html page

I am using a local html file to load content with images using UIWebview. I added all images to Image.xcassests. How to link images in Image.xcassests in a local html page to display

.menu {
    background: url("menu") no-repeat center center;
    background-size: 100% 100%;
    height: 16px;
    width: 26px;
} Menu is the name of the image assest i wish to use

I tried the following codes , images are not showing up

    NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"welcome" ofType:@"html"];
    NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
   [htmlWebView loadHTMLString:htmlString baseURL:[[NSBundle mainBundle] bundleURL]];

Also 
   NSURL *url = [[NSBundle mainBundle] URLForResource:@"welcome" withExtension:@"html"];
   NSURLRequest* request = [NSURLRequest requestWithURL:url];
   [ htmlWebView loadRequest:request];

      

+3


source to share





All Articles