I have an iPad app that pulls info from an RSS feed, but instead of pushing to present information in the next screen, I want to still show it in the same screen (see image)
When I use pushViewController NOTHING happens. When I use presentModalViewController the blue background changes to the webview. But what I want is when I click on a row from the feed on the left, the webview on the right gets the website.
I tested this with pushing to a new screen with a webview, and this DOES work, but I want it all in the same screen
Here is the code (obviously I've tried a few different things, and just left it in commented out):
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//EDITED to go to a webView instead of another table of info
if (_webViewController == nil) {
self.webViewController = [[[WebViewController alloc]
initWithNibName:@"WebViewController" bundle:[NSBundle mainBundle]] autorelease];
}
MWFeedItem *entry = [parsedItems objectAtIndex:indexPath.row];
_webViewController.entry = entry;
//[self.navigationController pushViewController:_webViewController animated:YES];
[self presentModalViewController:_webViewController animated:YES];
//BELOW UNFINISHED SO EDITED OUT
//self.webViewController._entry=[objectAtIndexPath:indexPath.row];
// Deselect
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
}
Not sure if my ViewController info is necessary, but here is an abridged version (placements are different, but everything else is the same)
- (void)viewDidLoad
{
[super viewDidLoad];
[scroll setScrollEnabled:YES];
[scroll setContentSize:CGSizeMake(3840, self.view.frame.size.height)];
ScheduleRVC *_scheduleRVC = [[ScheduleRVC alloc] initWithNibName:@"ScheduleRVC" bundle:nil];
[_scheduleRVC.view setFrame:CGRectMake(408, 283, 340, 572)];
[scroll addSubview:_scheduleRVC.view];
MySchedule *_mySchedule = [[MySchedule alloc] initWithNibName:@"MySchedule" bundle:nil];
[_mySchedule.view setFrame:CGRectMake(10, 57, 340, 800)];
[scroll addSubview:_mySchedule.view];
WebViewController *_webViewController = [[WebViewController alloc] initWithNibName:@"WebViewController" bundle:nil];
[_webViewController.view setFrame:CGRectMake(408, 57, 340, 184)];
[scroll addSubview:_webViewController.view];
}
Please help (it will save a kitten)
--ADDITION If it helps any, here's the code that works pushing from the RSS to a WebView (but like I said, I want them to appear on the screen together, and SplitView won't work for what I'm doing)
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Show detail
if (_webViewController == nil) {
self.webViewController = [[[WebViewController alloc] initWithNibName:@"WebViewController" bundle:[NSBundle mainBundle]] autorelease];
}
MWFeedItem *entry = [parsedItems objectAtIndex:indexPath.row];
_webViewController.entry = entry;
[self.navigationController pushViewController:_webViewController animated:YES];
// Deselect
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
}