2012-09-27 62 views

回答

12
-(IBAction)ButtunClickMethod:(id)sender{ 
//create the table view controller from nib 
     self.tblLisView = [[[tableListVC alloc] 
             initWithNibName:@"tableListVC" 
             bundle:[NSBundle mainBundle]] autorelease]; 

     //set popover content size 
     tblLisView.contentSizeForViewInPopover = CGSizeMake(170, 170); 

     //create a popover controller 
     self.popoverController = [[[UIPopoverController alloc] 
            initWithContentViewController:tblLisView] autorelease]; 


     //present the popover view non-modal with a 
     //refrence to the button pressed within the current view 
     [self.popoverController presentPopoverFromRect:popoverButton.frame 
               inView:self.view 
           permittedArrowDirections:UIPopoverArrowDirectionDown 
               animated:YES]; 
}