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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:01:59+00:00 2026-06-11T03:01:59+00:00

In my class derived from UIViewController I have a class variable of type UIWebView*

  • 0

In my class derived from UIViewController I have a class variable of type UIWebView* called helpView. And I use the following code for viewDidLoad.

- (void)viewDidLoad {
    [super viewDidLoad];
    NSURL *helpFileURL=[NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/tutorial.html",
                                               [[NSBundle mainBundle] resourcePath]]];
    NSURLRequest *request = [NSURLRequest requestWithURL:helpFileURL];
    [helpView loadRequest:request];
}

and things work fine, I can see “tutorial.html” on my simulator and device.

Now here is my question, I want to use a CSS file called tutorial.css along with my tutorial.html.
In the same way tutorial.html is in the app bundle, tutorial.css is also in the app bundle.

How should I modify the code above for this to work?
I tried a few things on my own, but failed. And I did not find anything clear answer looking on the web.
Obviously if I use the usual:

  <link href="css/tutorial.css" rel="stylesheet" type="text/css" />

in my tutorial.html file it is not enough.

Thanks for any information.

  • 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-11T03:02:01+00:00Added an answer on June 11, 2026 at 3:02 am

    Leave out the css directory, your bundle doesn’t work that way.

    <link href="tutorial.css" rel="stylesheet" type="text/css" />
    

    Then change your code to load the html with a nice base url:

    - (void)viewDidLoad {
        [super viewDidLoad];
    
        NSString *filePath = [[NSBundle mainBundle] pathForResource:@"tutorial" ofType:@"html"];
        NSString *htmlString = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
    
        NSURL *baseURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]];
    
        [webView loadHTMLString:htmlString baseURL:baseURL];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a derived derived class from an abstract class. The code is below.
I have a some code that gets passed a class derived from a certain
I have the following EF class derived from a database (simplified) class Product {
In my current code I have an TNCPConnection class which is derived from enable_shared_from_this
I have a custom class derived from QGraphicsPixmapItem. Its called GraphPixmapItemCustom and it's overloaded
I have created a class derived from NSImageView. However, the classes's constructor (init) is
I have a class derived from CTreeCtrl . In OnCreate() I replace the default
I have a class derived from Dictionary. I need this class to simulate a
I have a c++ class derived from a base class in a framework. The
I have created an ASP.NET class derived from the standard WebControls.TextBox , with the

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.