I am trying to convert my iPad app from using a Tab Bar Controller as its Root View to using a Split View Controller for it. My code in my AppDelegate.h is:
The .m is:
I use IB to set all this up, and I Added a SplitViewController in the MainWindow, and connected the AppDelegate Connection for SplitViewController to the SplitViewController I added. Under the Navigation Controller in the SplitViewController I set the root view to RootViewiPad (The TableView that parses a blog and shows the articles), and then set the other View Controller Class and NIB to WebViewController2 which is where I would like the articles to display once they are clicked on. When I run the app, it compiles, and I can see the WebViewController2 that I built in IB, and when I rotate, the left hand side is the TableView I created. However, I can't figure out how to get it to load the URL in the WebViewController2. Everything I have tried either does nothing, or merely pushes it on the Master Side of the controller.
Any suggestions?
Code:
@class RootViewiPad;
@class WebViewController2;
@interface AppDelegate : NSObject <UIApplicationDelegate, UISplitViewControllerDelegate> {
UIWindow *window;
UISplitViewController *splitViewController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UISplitViewController *splitViewController;
@end
Code:
#import "AppDelegate.h"
#import "WebViewController2.h"
@implementation AppDelegate
@synthesize window;
@synthesize splitViewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window.rootViewController = self.splitViewController;
[self.window makeKeyAndVisible];
return YES;
}
Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
WebViewController2 *detailViewController =
self.webViewController2;
detailViewController.webView.scalesPageToFit = NO;
RSSEntry *entry = [_allEntries objectAtIndex:indexPath.row];
[detailViewController.webView loadHTMLString:entry.articleImage baseURL:[NSURL URLWithString:nil]];
}
}