Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8151937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:33:33+00:00 2026-06-06T15:33:33+00:00

I am receiving an image, title and description from a json file and i

  • 0

I am receiving an image, title and description from a json file and i need to display this on a view. I am using webview because the description attribute has links and is in html format so webview is easiest. However now i need to add the image and title above the description. I know how i can add an image seperately but i dont know how i can add all these three components in the webview. Any help? Thank you

NSString * myHTMLImage = @"<img src='Hop.png'>";
NSString *imagePath = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:imagePath];
[self.webView loadHTMLString:myHTMLImage baseURL:baseURL];

The above code embeds an image to the entire webview.

[self.webView loadHTMLString:bodyOfText baseURL:nil]; 

I need to be able to do the above loading of bodyOfText as wel. and a title too. which is a string. How do i do it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T15:33:35+00:00Added an answer on June 6, 2026 at 3:33 pm

    You just build up your HTML string. You could do something like:

    NSString *title      = @"this is my title";
    NSString *body       = [NSString stringWithFormat:@"Blah, blah, blah<p>%@<p>", self.bodyOfText.text];
    NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
    NSString *imgPath    = [bundlePath stringByAppendingPathComponent:@"Hop.png"];
    NSURL    *imgUrl     = [NSURL fileURLWithPath:imgPath];
    
    NSString *html = [NSString stringWithFormat:
                      @"<html>"
                      "<header>"
                      "<title>%@</title>"
                      "</header>"
                      "<body>"
                      "%@"
                      "<img src=\"%@\">"
                      "</body>"
                      "</html>",
                      title, body, [imgUrl absoluteString]];
    
    [self.webView loadHTMLString:html baseURL:nil];
    

    I usually build my references to images right in the src tag, that way I can easily refer to both images in my bundle as well as images in my Documents folder in the same HTML string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My webserver is receiving image data from an iOS App via HTTP POST. The
Im trying to read in image file from a server , with the code
I have a image URL from which I need to fetch the images. But
I've converted a Flash SWF file to HTML5 using Google Swiffy. This works fine
I have problem with receiving an image over TCP socket [.net 4.0] Server: Socket
I'm retreiving images from a web server directory like this: WebClient webClientImgDownloader = new
I'm receiving suddenly this error on a Win2003 Server Web Application: Microsoft VBScript runtime
Background I'm receiving the following error when trying to render a partial view in
I'm receiving this error on a page that previously worked fine, in fact the
I have a web server which receives an image from a client and do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.