views:

40

answers:

1

I am loading as secondary view with its own xib file. I can load it fine, but cannot get the webview in it to load any content. I have another app where this proces works, but it is in the main view.

Here is the code I am using.

@synthesize webView;

- (void)viewDidLoad
{
    NSString *path = [[NSBundle mainBundle] pathForResource:@"workshop" ofType:@"htm" inDirectory:@"dirA"];
    NSFileHandle *readHandle = [NSFileHandle fileHandleForReadingAtPath:path];

    NSString *htmlString = [[NSString alloc] initWithData: 
       [readHandle readDataToEndOfFile] encoding:NSUTF8StringEncoding];

// to make html content transparent to its parent view -
// 1) set the webview's backgroundColor property to [UIColor clearColor]
// 2) use the content in the html: <body style="background-color: transparent">
// 3) opaque property set to NO
//
webView.opaque = NO;
webView.backgroundColor = [UIColor clearColor];
[self.webView loadHTMLString:htmlString baseURL:nil];
[htmlString release];
}

- (void)dealloc
{   
    [webView release];
    [super dealloc];
}





-(IBAction)switchCanary {

 [self dismissModalViewControllerAnimated:YES];
}

-(IBAction)switchBack {

 [self dismissModalViewControllerAnimated:YES];
}
@end
+1  A: 

I figured it out. For some reason I was able to load .htm files before. I had to change them all to .html and now it works. Maybe a recent change. The other app was a couple SDK versions ago.