In my most frustrating roadblock to date, I've come across a UIWebView that will NOT scroll! I call it via this IBAction:
-(IBAction)session2ButtonPressed:(id)sender
{
Session2ViewController *session2View = [[Session2ViewController alloc]initWithNibName:@"Session2ViewController" bundle:nil];
self.addictionViewController = session2View;
[self.view insertSubview:addictionViewController.view atIndex:[self.view.subviews count]];
[session2View release];
}
In the viewDidLoad of Session2ViewController.m, I have
- (void)viewDidLoad
{
[super viewDidLoad];
// TRP - Grab data from plist
// TRP - Build file path to the plist
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Addiction" ofType:@"plist"];
// TRP - Create NSDictionary with contents of the plist
NSDictionary *addictionDict = [NSDictionary dictionaryWithContentsOfFile:filePath];
// TRP - Create an array with contents of the dictionary
NSArray *addictionData = [addictionDict objectForKey:@"Addiction1"];
NSLog(@"addictionData (array): %@", addictionData);
// TRP - Create a string with the contents of the array
NSString *addictionText = [NSString stringWithFormat:@"<DIV style='font-family:%@;font-size:%d;'>%@</DIV>", @"Helvetica", 18, [addictionData objectAtIndex:1]];
addictionInfo.backgroundColor = [UIColor clearColor];
// TRP - Load the string created and stored into addictionText and display in the UIWebView
[addictionInfo loadHTMLString:addictionText baseURL:nil];
// TODO: MAKE THIS WEBVIEW SCROLL!!!!!!
}
In the nib, I connected my web view to the delegate and to the outlet. When I run my main project, the plist with my HTML code shows up, but does not scroll. I copied and pasted this code into a new project, wired the nib the exact same way, and badda-boom badda-bing. . . it works. I even tried to create a new nib from scratch in this project, and the exact same code would not work.
Whiskey
Tango
Foxtrot
Any ideas???
Thanks! Thomas