ConfusedDeer
ConfusedDeer

Reputation: 3415

Use 'loadRequest' instead of 'loadHTMLString'?

How do I convert the following to use 'loadRequest' instead of 'loadHTMLString'?

I need to add a HTTP header and the only way I have found is to use loadRequest with a NSMutableURLRequest as explained here.

myHTMLContent = [NSString stringWithFormat:@"<head>%@</head><body>%@</body>", @"<link href='styles.css' rel='stylesheet' type='text/css'>", htmlFromPrevVar]; 

    NSString *myPath = [[NSBundle mainBundle] resourcePath];
    NSURL *myBaseURL = [NSURL fileURLWithPath:myPath];

    [self.myUIWebView loadHTMLString:myHTMLContent baseURL:myBaseURL];

Upvotes: 1

Views: 620

Answers (1)

matt
matt

Reputation: 535193

Save the string to a file and give the URL of that file in your request.

Upvotes: 2

Related Questions