Posted By

espinallab on 05/10/11


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

Tintenklecks
cnathan


Display a UIPopoverController


 / Published in: Objective C
 

  1. //declare this in the .h file
  2. InfoPopoverController *popoverContent;
  3. UIPopoverController *popover;
  4.  
  5.  
  6. -(IBAction) infoButtonClicked:(id)sender{
  7. popoverContent=[[InfoPopoverController alloc] initWithNibName:@"InfoPopoverController" bundle:nil];
  8. popover = [[UIPopoverController alloc] initWithContentViewController:popoverContent];
  9. [popover setDelegate:self];
  10. [popover setPopoverContentSize:CGSizeMake(989,545)];
  11. popoverContent.contentSizeForViewInPopover=popoverContent.view.bounds.size;
  12. [popover presentPopoverFromRect:((UIView *)sender).frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
  13. }
  14.  
  15. - (void)popoverControllerDidDismissPopover:(UIPopoverController*)popoverController{
  16. if (popover) {
  17. [popover dismissPopoverAnimated:YES];
  18. [popover release];
  19. popover=nil;
  20. if (popoverContent != nil) {
  21. [popoverContent release];
  22. popoverContent = nil;
  23. }
  24. }
  25. }
  26. -(void)killPopoversOnSight {
  27. if (popover) {
  28. [popover dismissPopoverAnimated:NO];
  29. }
  30. }
  31.  

Report this snippet  

You need to login to post a comment.