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 7776283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:50:36+00:00 2026-06-01T17:50:36+00:00

I’m trying to make an iOS app that allows the user to create an

  • 0

I’m trying to make an iOS app that allows the user to create an unlimited amount of HTML document and save them into the documents folder of the app. This is sort of like a combo question but how can I display a file that is in the documents dictionary.

So my two question are:

How to display HTML file that are in the document dictionary

And

How to allow the user to created unlimited folders and html files

Sorry for the double question…

  • 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-01T17:50:37+00:00Added an answer on June 1, 2026 at 5:50 pm

    Saving HTML and Other Text Files to the Documents Directory

    First, you need to know the path to your documents directory:

    NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsPath = [paths objectAtIndex:0];
    

    You can create documents and directories there up to the limits of the device storage. Be aware, however, that only files in the root will show up in iTunes Document Sharing.

    So, if you have a string htmlContent and a string htmlFilename, you can save it. Do pay attention to the encoding you’re using; the encoding in the HTML header and meta tags (if present) should match the encoding used here.

    NSString *htmlPath = [documentsPath stringByAppendingPathComponent:htmlFilename];
    [htmlContent writeToFile:htmlPath atomically:NO encoding:NSUTF8StringEncoding error:nil];
    

    Displaying HTML Files Within Your App

    You can display HTML in a UIWebView. Assuming you have one called webView, you can display any NSURL object in it:

    NSURL *stackOverflowAddress = [NSURL URLWithString:@"http://www.stackoverflow.com"];
    [[self webView] loadRequest:[NSURLRequest requestWithURL:stackOverflowAddress]];
    

    This can include the file you just wrote:

    NSURL *htmlURL = [NSURL fileURLWithPath:htmlPath];
    [[self webView] loadRequest:[NSURLRequest requestWithURL:htmlURL]];
    

    Or, you can put a string into it directly:

    [[self webView] loadHTMLString:htmlContent baseURL:nil];
    

    If you use a UIWebView for a lot of your functionality, take the time to read the UIWebViewDelegate Protocol Reference.

    Opening HTML in Safari

    It is also possible to tell your application to open URLs elsewhere. This will usually result in Safari opening. However, because Safari does not have access to your app’s document directory, it cannot display documents while they are saved locally.

    [[UIApplication sharedApplication] openURL:stackoverflowAddress];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.