Skip to content

Instantly share code, notes, and snippets.

@alvises
Created September 25, 2016 18:18
Show Gist options
  • Save alvises/b4250d16c3cbb6557e38b0d784de9dba to your computer and use it in GitHub Desktop.
Save alvises/b4250d16c3cbb6557e38b0d784de9dba to your computer and use it in GitHub Desktop.
-(void)presentPopoverFromView:(UIView *)fromView
onModalViewController:(UIViewController*)modalViewController {
[self presentPopoverFromView:fromView];
 
//converting the origin of the popover from the old parent view to the new modal view
self.origin = [modalViewController.view convertPoint:self.origin fromView:_parentView];
 
//the new parent view is the modal view
[self.view removeFromSuperview];
_parentView = modalViewController.view;
[_parentView addSubview:self.view];
 
[self setupView];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment