I am working on an app that uses a splitViewController that loads a html file from a sqlite database. I have an iphone app that does the same thing. It loads a tableview with the database contents and then pushes a webview onto the stack when user touches a cell. All works great with the iPhone app, but not in the iPad with the splitViewController. Everything works except when loading the webview.
Here is the concerned code in the header file:
#import <UIKit/UIKit.h>
@class LIDetailViewController;
@interface LIMasterViewController : UITableViewController <UISearchBarDelegate>{
@property (strong, nonatomic) LIDetailViewController *detailViewController;
And in the implementation file:
@synthesize detailViewController = _detailViewController;
Here is the code that it is crashing on:
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
if (!_detailViewController) {
_detailViewController = [[LIDetailViewController alloc] initWithNibName:@"LIDetailViewController" bundle:nil];
}
[self.navigationController pushViewController:self.detailViewController animated:YES];
}
NSString *sqlData = [animal description];
NSString *htmlHead = @"<head><link type='text/css' rel='stylesheet' href='default.css'><head/><body><div class='content'>";
NSString *htmlBody = [sqlData stringByAppendingString:@"</div>"];
NSString *html = [htmlHead stringByAppendingString:htmlBody];
[_detailViewController.animalDescripton loadHTMLString:html baseURL:nil];
It is crashing on the line that says:
[_detailViewController.animalDescripton loadHTMLString:html baseURL:nil];
This is the error in the debugger: “[UINavigationController animalDescripton]: unrecognized selector sent to instance 0x685fa70”
If anyone can help me with this it would be great! Thanks in advance.
You apparently never set
self.detailViewControllerwhen on the iPad, so it seems to default to aUINavigationController.