Reputation: 3657
I need some assistance to approach this. I have created a UITabBarController
where I have two tabs. And in one of them I made it to pop with UIPopoverController
where I use a UITableView
inside the UIPopoverController
. I load the tableView with two objects using table view datasource and I can see them when the UIPopoverController
appears.
You can check the screen shot here:
Now what I want to achieve is that, when I click on feedback then I need to be directed/taken to feedbackViewController
and the same with the other object Download, it should take me to the downloadViewController
.
I know that I need to use table view method:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
But I am not having an idea of how I can do this. So any general information of how I can approach this problem would be appreciated.
Upvotes: 0
Views: 364
Reputation: 4164
It sounds quite simple. All you need to do is identify which button was pressed, in this case 0 for Feedback and 1 for Download. Then depending on that present the appropriate view controller. You will probably need to have a link to a parent, which will ultimately present the new view. Otherwise you will be presenting the view inside the popover controller.
Somewhere when creating/displaying your UIPopoverController
create a reference to the parent
UIViewController *mainparent = _mainparent; //where _mainparent is the reference passed through.
Then in your -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
include the following.
if (indexPath.row == 0)
[mainparent presentModalViewController:feedbackViewController animated:YES];
else
[mainparent presentModalViewController:downloadViewController animated:YES];
That will modally present the required view controllers.
Upvotes: 1