-2

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];

}

enter image description here

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];

}
SnowboardBruin
  • 3,645
  • 8
  • 36
  • 59
  • Why aren't you using a `UISplitViewController`? – rob mayoff Feb 04 '12 at 20:51
  • This screen is only one aspect of many for this app, and split will not work with the other features. – SnowboardBruin Feb 04 '12 at 23:14
  • You cannot provide information with the dropper and force people to guess what you want to do to help you. – viggio24 Feb 05 '12 at 07:21
  • viggio24, see the first sentence "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)". – SnowboardBruin Feb 05 '12 at 17:47

1 Answers1

1

Well if you want a dead-simple solution, you can fake staying in the same view by simply not animating the transition to your modal controller view, ie. [self presentModalViewController:_webViewController animated:NO];. You'd also have to disable animation when you dismiss the UIWebView, ie. [self dismissModalViewControllerAnimated:NO].

Alternatively, you could have both your RSS Feed view and the UIWebView in the same view, and simply hide the RSS Feed view (and unhide the UIWebView) when you want to present the web view, and do the opposite when you want the RSS Feed visible.

Hope that helps (enough to save that kitten).

EDIT: I should mention that these are not necessarily following Apple's recommended design patterns, I'm just providing solutions that will solve your current problem. I'd need more information to determine whether your design is correct or not.

Andrew R.
  • 923
  • 2
  • 8
  • 14