Im trying to use presentViewController inside a UIView.
http://img145.imageshack.us/img145/6334/appt.png
When I click he "+" button at the top/right, I want to replacer the tableview at the right (in the grey part of the image) by a UIViewController.
- (void)add:(id)sender
{
UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"testview"];
[self presentViewController:controller animated:YES completion:NULL];
}
Of course by doing this, the whole screen is replaced.. I want something like this:
[contentView addSubview:controller];
or
[contentView presentViewController:controller animated:YES completion:NULL];
where contentView is an UIView containing the tableview
I found this addChildViewController and presentViewController but I don't think that can help me out
Thanks
EDIT:
Use ContainerView in storyboard solved my problem
A PopoverController seems to be what you need. Here is some boilerplate code:
aPopoverController is a property of the class.
If I understand clearly. This would help you out
Sorry if Iam wrong...
I am not sure if I understand you right. From your picture I believe you are programming for an iPad, and you want to cover the whole view partly by another view. If so, you could use a
UIPopoverController
, which does exactly this.You can add the controller's
view
as a subview of yourcontentView
. Be sure to keep a strong reference to the controller when you do that though.Another approach would be to make the new view owned by the presenting controller instead of a second controller and simply hide/show views as needed.
edit your statement:
try this and then let me know if it worked!