-1

Let me preface this by saying that I'm a totally noob when it comes to iOS development and have decided to learn by just diving straight in

I've started my app by using the Master-Detail view application template, and have a UIWebView in the DetailView.

I'm looking to display a popover at any arbitrary location in response to an event like this, however I'm having trouble doing this. Everything I google either attaches the popup to a button, or does not use storyboards.

I would love some guidance on how I can approach this

Community
  • 1
  • 1
Josh Hunt
  • 14,225
  • 26
  • 79
  • 98

2 Answers2

3

Use the below code and make change in CGRectMake(0, 0, 100, 100) to whatever position you like.

FirstViewController *firstViewController = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
UINavigationController *modalNavigationController = [[UINavigationController alloc] initWithRootViewController:firstViewController];
UIPopoverController *popoverControllerTemp = [[UIPopoverController alloc] initWithContentViewController:modalNavigationController];
self.popoverController = popoverControllerTemp;
[self.popoverController presentPopoverFromRect:CGRectMake(0, 0, 100, 100) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]
Paramasivan Samuttiram
  • 3,728
  • 1
  • 24
  • 28
  • Please forgive my ignorance, but how do I get to the popoverController part? I've made a popover view in my storyboard http://i.imgur.com/uqwfc.png and attached it to my detail view with popover, but how do I connect that to your code? – Josh Hunt Nov 27 '12 at 07:48
  • Paramasivan, thanks for your edit, but I'm afraid I will need a little more help, or at least a push in the right direction. Being new to iOS dev, I'm struggling with how to get from what I have now (basic Master-Detail view application) to what you posted – Josh Hunt Nov 27 '12 at 10:21
0

If you don't mind using a Open Source project you can use this.

Johan de Klerk
  • 2,515
  • 3
  • 25
  • 35