1

i am using a TableView in my application where i want a Pop over View when i clicked on a tabel cell, all the content which is in table Cell should display in a pop over view so plz suggest me how to do??

i have some sample code below which is not working..so suggest with code i want all the content in the cell to displayed in the pop over view.

  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{

UIView *aView = [[UIView alloc] init];

UIPopoverController *popoverController = [[UIPopoverController alloc] 
                                          initWithContentViewController:aView];
popoverController.popoverContentSize = CGSizeMake(320, 416);
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
[popoverController presentPopoverFromRect:cell.bounds inView:cell.contentView 
                 permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

}

crazy2431
  • 801
  • 2
  • 19
  • 36
  • possible duplicate of [how to display popover click on a tableview cell in ipad](http://stackoverflow.com/questions/8337149/how-to-display-popover-click-on-a-tableview-cell-in-ipad) – visakh7 Dec 01 '11 at 06:38
  • possible duplicate of [How to correctly present a popover from a UITableViewCell with UIPopoverArrowDirectionRight or UIPopoverArrowDirectionLeft](http://stackoverflow.com/questions/3015400/how-to-correctly-present-a-popover-from-a-uitableviewcell-with-uipopoverarrowdir) – Louis Oct 21 '14 at 11:20

1 Answers1

0

use this

[popoverController presentPopoverFromRect:[cell frame] inView:cell.contentView 
                 permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

and then check.

Ankit Srivastava
  • 12,347
  • 11
  • 63
  • 115
  • nope its working its throwing exception related to View in the above code where ther is aView. – crazy2431 Nov 30 '11 at 10:58
  • try using self.view instead of cell.contentView – Ankit Srivastava Nov 30 '11 at 11:24
  • its throwing exception in this line UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController:aView]; – crazy2431 Nov 30 '11 at 11:29
  • you need a view controller object instead of uiview object cause it says.. "initWithContentViewController:", its better you create a new class which is uiviewcontroller subclass , then import it and create its object and then pass it "initWithContentViewController:". – Ankit Srivastava Nov 30 '11 at 11:46
  • actually my main class is UIViewcontroller class..in that i hv added sub class UITablesView controller class.so u want me to create New UIviewController sub class??how to call its object or create its object and cal it?can i have a sample code? – crazy2431 Nov 30 '11 at 12:04
  • refer this.. http://www.raywenderlich.com/1056/ipad-for-iphone-developers-101-uipopovercontroller-tutorial – Ankit Srivastava Nov 30 '11 at 12:10