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

  • Home
  • SEARCH
  • 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 3334698
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:56:02+00:00 2026-05-17T23:56:02+00:00

The best example to explain my situation is to use a blog post. Let’s

  • 0

The best example to explain my situation is to use a blog post. Let’s say I have a UITableView loaded with title’s of blog posts that I got from an API. When I click on a row I want to show the detailed blog post.

When doing that, the API is handing back several fields, including the “post body” (which is HTML text). My question is, what should I use to display it so it shows up as formatted HTML? Should I use a UIWebView for that? I’m not sure if you use a UIWebView when you are literally viewing a web page (like initialize it with a URL or something) or if you can hand it an HTML string and it will format it properly.

There are several other fields that will be showing on this page, such as title, category, author, etc. I’m just using UILabels for those, so no problems there. But I don’t know what to do with the HTML chunk. I’m doing all of this programmatically, btw.

If you can’t tell, I’m relatively new to iOS development, only about 2-3 weeks in, with NO obj-c background. So if a UIWebView is the right approach, I’d also appreciate any “gotcha!” notes, if there are any.

  • 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-05-17T23:56:02+00:00Added an answer on May 17, 2026 at 11:56 pm

    As David Liu said, UIWebview is the way to go. I would recommend a few building the HTML string separately and then passing it to the UIWebView. Also, I’d make the background transparent, using [webView setBackgroundColor:[UIColor clearColor]] so that you have an easier time making things look as they should.

    Here’s a code sample:

    - (void) createWebViewWithHTML{
        //create the string
        NSMutableString *html = [NSMutableString stringWithString: @"<html><head><title></title></head><body style=\"background:transparent;\">"];
    
        //continue building the string
        [html appendString:@"body content here"];
        [html appendString:@"</body></html>"];
    
        //instantiate the web view
        UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.frame];
    
        //make the background transparent
        [webView setBackgroundColor:[UIColor clearColor]];
    
        //pass the string to the webview
        [webView loadHTMLString:[html description] baseURL:nil];
    
        //add it to the subview
        [self.view addSubview:webView];
    
    }
    

    NOTE:

    The benefit to using a ‘NSMutableString’ is that you can continue to build your string through an entire parsing operation and then pass it to the the ‘UIWebView’, whereas a ‘NSString’ cannot be changed once it is created.

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

Sidebar

Related Questions

Currently, if I want to get a certain collection of products, for example best-selling,
I will try my best to explain what's going on. The app that I'm
I know VERY little about UNIX commands, so I´ll do my best to explain
It's very easy to explain NoSQL from high level view - it is basically
This question: Best way to return status flag and message from a method in
I think my question might be unclear , but i would try to explain
This is a best practice question, and I expect the answer to be it
As we all know with Java comes the Collections API that provide us with
im using spring+hibernate for a desktop application. I'm trying to build it with a

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.