Note that there are some explanatory texts on larger screens.

plurals
  1. POUIPopoverController showing empty frame
    primarykey
    data
    text
    <p>So I am trying to display a <code>UITableView</code> inside a <code>UIPopoverController</code> using the piece of code shown below</p> <pre><code>vc = [[ActionsViewController alloc] init]; initWithContentViewController:vc]; actionsController = [[UIPopoverController alloc] initWithContentViewController:vc]; actionsController.delegate = self; NSLog(@"Try to sho it "); [actionsController presentPopoverFromBarButtonItem:(UIBarButtonItem*)sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; </code></pre> <p>And this is ActionsViewController.m which is a subclass of <code>UITableViewController</code></p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; NSMutableArray* list = [[NSMutableArray alloc] initWithCapacity:4]; self.actionList = list; self.clearsSelectionOnViewWillAppear = NO; self.contentSizeForViewInPopover = CGSizeMake(320.0, 400.0); [self.actionList addObject:@"Print as book"]; [self.actionList addObject:@"Print page"]; [self.actionList addObject:@"Save Page"]; [self.actionList addObject:@"Share"]; } - (int)numberOfSectionsInTableView:(UITableView *)tableView { NSLog(@"in number of section"); return 1; } - (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } NSString* lab = [self.actionList objectAtIndex:indexPath.row]; NSLog(@"here in there"); cell.textLabel.text = lab; return cell; } - (NSInteger)numberOfRowsInSection:(NSInteger)section { return [self.actionList count]; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (self.delegate != nil) { [self.delegate actionSelected:indexPath.row]; } } </code></pre> <p>The corresponding .h file</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @protocol KLActionsViewControllerDelegate - (void)actionSelected:(NSInteger)index; @end @interface KLActionsViewController : UITableViewController &lt;UITableViewDataSource,UITableViewDelegate&gt; @property (nonatomic, retain) NSMutableArray* actionList; @property (nonatomic, assign) id&lt;KLActionsViewControllerDelegate&gt; delegate; @end </code></pre> <p>Also, I don't think the functions <code>cellForRowAtIndexPath</code> and <code>numberOfSectionsInTableView</code> are getting called because I don't see any console output.</p> <p>EDIT: This is what I see in the popover</p> <p>:<img src="https://i.stack.imgur.com/pcPaD.jpg" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload