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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:36:48+00:00 2026-06-14T12:36:48+00:00

As far as I understand, the standard UIWebView is able to display local files

  • 0

As far as I understand, the standard UIWebView is able to display local files of numerous extensions. Since I need to display formatted text in my application, I thought this method is the way to go.

So, I created a rich text file, called test.rtf, and I am currently trying to display it in my webview. However, I am unsuccessful. I see only a blank white screen instead of the text I typed into the rtf file.

Can someone look at my code and point out where I went wrong with the implementation?

Header file:

#import <UIKit/UIKit.h>
@interface MainViewController : UIViewController <UIWebViewDelegate> {
UIWebView * webView;
}
@end

Main file:

#import "MainViewController.h"
@interface MainViewController ()
@end
@implementation MainViewController

- (id)init
{
self = [super init];
if (self) {
    // Customization at initialization
    self.view.backgroundColor = [UIColor clearColor];

    //Adding a webview to display richtext documents
    int webHeight = self.view.bounds.size.height;
    webView = [[UIWebView alloc] initWithFrame:CGRectMake(0.0, 150.0, 320.0, webHeight-150.0)];
    webView.dataDetectorTypes = NO;
    webView.scrollView.bounces = NO;
    webView.delegate = self;
    [webView setBackgroundColor:[UIColor clearColor]];
    [webView setOpaque: NO];
    [self.view addSubview:webView];
    }
return self;
}

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.

// Accessing richtext file
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"rtf"];
NSURL *url = [NSURL fileURLWithPath:filePath];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
if (request) {
    // Additional configuration
}

//Adding the content of the webiew
[webView loadRequest:request];
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
  • (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    NSLog(@”delegate called”);
    // Do whatever you want here
    return YES;
    }
    @end
  • 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-14T12:36:49+00:00Added an answer on June 14, 2026 at 12:36 pm

    You should set your UIWebView‘s delegate and return YES. UIWebViewDelegate Protocol Reference says:

    webView:shouldStartLoadWithRequest:navigationType:

    Sent before a web view begins loading a frame.

    So you should return YES for the first time to load your test.rtf file.

    As you have updated your question. You need to set

    webView.delegate = self;
    //webView.delegate = appDelegate;    // not this line
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As far as I understand, https is http plus SSL/TLS. What do I need
As far as I understand, the onchange event of a text input element is
As far as I understand, all the built-in standard apps like (email, music, calendar
I need to programmatically render JSP page. As far as I understand, JSP should
As far as I understand a web application is a rich, dynamic webpage, containsing
As far as I understand from the documentation the QUdpSocket are async but, still,
As far as I understand Facebook allowes you (through the API) to post on
As far as I understand the serial port so far, transferring data is done
As far as I understand WebRequest.PreAuthenticate is almost always good. If I enable it
As far as I understand the branch-on-sign is the name of some kind of

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.