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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:42:24+00:00 2026-06-12T22:42:24+00:00

Specifically — how do you get all the assets to load from their respective

  • 0

Specifically — how do you get all the assets to load from their respective directories (images/, css/, js/) without changing the content of the original HTML (removing directories)?

I am using this code to load index.html into the UIWebview:

NSURL *url = [[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html"];
NSString *html = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];

NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];

[webView loadHTMLString:html baseURL:baseURL];

Then my html looks like this:

...
<link rel="stylesheet" type="text/css" href="css/main.css" />
<script type="text/javascript" src="js/classes.js"></script>
<script type="text/javascript" src="js/animate.js"></script>
etc...

If I remove the js/, css/, and images/, everything works because iOS thinks everything is in the root of my bundle. But, that means I cant use the same code across projects without dumping it all into one directory (lame). The engineer in me can’t deal with this kind of disorganization.

Thanks in advance.

  • 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-12T22:42:26+00:00Added an answer on June 12, 2026 at 10:42 pm

    Easy: when you add the folder(s) to Xcode, make sure you add them as folder references.

    They will then be added as folders to the .app bundle:

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

Sidebar

Related Questions

Specifically, how do you get the image subview from a uitableview cell? My table
Specifically: Is it assured somehow that all versions of glibc 2.x are binary compatible?
Specifically I am trying to open a file from SharePoint, but it's really just
Specifically my middleware is interested to differentiate between a GET request on: /admin/app/model/? /admin/app/model/
Specifically I want all PasswordBox's using a Style to have the same static KeyDown
Specifically, how does it differ from the default ( async: true ) ? In
Specifically, is there a way for a task to get a reference to itself?
Specifically I have code that simplifies to this: from datetime import datetime date_string =
Specifically, im looking for a way to add links to all the words in
Specifically, can I call a proc from the current database in a view. I

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.