Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 7th, 2012  |  syntax: None  |  size: 2.59 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. position of UIPopoverController in iPad
  2. -(IBAction)product2_click_h2
  3. {
  4.     //build our custom popover view
  5.     UIViewController* popoverContent2 = [[UIViewController alloc]
  6.                                          init];
  7.  
  8.     UIView* popoverView2 = [[UIView alloc]initWithFrame:CGRectMake(100,100,200,200)];
  9.  
  10.     popoverView2.backgroundColor = [UIColor greenColor];
  11.  
  12.     UITextView *prod2_info = [[UITextView alloc]initWithFrame:CGRectMake(5,5,390,290)];
  13.     [prod2_info setFont:[UIFont fontWithName:@"Arial" size:15]];
  14.     [popoverView2 addSubview:prod2_info];
  15.     [prod2_info setEditable:NO];
  16.     prod2_info.text = @"n"
  17.     "                    Higher Mileage Motor Oil :n "
  18.     "                --------------------------------------nn"
  19.     "  -->  MaxLife NextGen Higher Mileage Motor Oil  nn"
  20.     "- Special seal conditioners rejuvenate sealsn"
  21.     "   within the engine block to help n"
  22.     "   prevent oil leaks that lead to sludge and deposits.n"
  23.     "- Anti-oxidant additives reduce oil viscosity breakdownn"
  24.     "  to help prevent engine clogging sludge and deposit formation. n"
  25.     "- Detergents chemically bond with and remove existingn"
  26.     "  sludge and depositsn"
  27.     "- Additional friction-reducing additives help reduce abrasion within enginen"
  28.     "- Anti-wear agents help prevent engine damage n"
  29.     "- Available in the following viscosity grades n"
  30.     "    - 5W-30     n "
  31.     "   - 10W-30    n ";
  32.     prod2_info.scrollEnabled =YES;
  33.     popoverContent2.view = popoverView2;
  34.     popoverContent2.contentSizeForViewInPopover = CGSizeMake(400,300);
  35.  
  36.     //create a popover controller
  37.     self.popovercontroller_2 = [[UIPopoverController alloc]
  38.                                 initWithContentViewController:popoverContent2];
  39.  
  40.     //present the popover view non-modal with a
  41.     //refrence to the button pressed within the current view
  42.     [self.popovercontroller_2 presentPopoverFromRect:product2.frame
  43.                                               inView:self.view
  44.                             permittedArrowDirections:UIPopoverArrowDirectionAny
  45.                                             animated:YES];
  46.  
  47. }
  48.        
  49. [self.popovercontroller_2 presentPopoverFromRect:product2.frame
  50.                                           inView:self.view
  51.                         permittedArrowDirections:UIPopoverArrowDirectionAny
  52.                                         animated:YES];
  53.        
  54. [self.popovercontroller_2 presentPopoverFromRect:product2.frame
  55.                                           inView:**button.bounds**
  56.                         permittedArrowDirections:UIPopoverArrowDirectionAny
  57.                                         animated:YES];