0

My question is two part:

Part 1:

I've a UITableView that has 4 rows, when the user click on any cell, it will display an internal UITableView, i've expanded the size of the master UITableView, then insert the internal UITableView

internalTableView = [[InternalApartmentTableViewController alloc] initWithFrame:CGRectMake(0, 44, 550, (([[tableContent objectAtIndex:indexPath.row] count] - 1) * 44))];
[cell addSubview:internalTableView];

The didSelectedRow is:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (selectedInternal != -1) {
    selectedInternal = -1;
} else {
    selectedInternal = indexPath.row;
    [internalTableView removeFromSuperview];
    [internalTableView release];
}
[tableViews reloadData];

}

i was testing the app using a small number of row for the internal UITableView, the height = 700 and everything work perfectly, between when i've used a real data, the height = 2500 and when the data displayed, the height appear around = 1000, i don't need the internal UITableView to be scrollable, just the master UITableView is scrollable.

So, how can i expand the frame size of the UTableView as much as i want?

Part 2:

In the internal UITableView, I've used a custom cell that contain labels and images and 2 buttons, one of the buttons when it's clicked, i wanna show a UIPopOver from where it is, i can't determine the place of the button in the view, actually, i can't figure out which view shall i need to use to display the UIPopOver in the screen using

[popoverController presentPopoverFromRect: //(How can i get the rect for the button)
                   inView: //(in which view should the PopOver appear, master UITableView or Internal UITableView or Custom Cell)
                   permittedArrowDirections:UIPopoverArrowDirectionLeft
                   animated:YES];

Any help will be appreciated.

Scar
  • 3,460
  • 3
  • 26
  • 51
  • 1
    Embedding one table view inside another sounds like trouble. Apple's suggestion for handling cases like this (covered in some [sample code](https://developer.apple.com/library/ios/#samplecode/TableViewUpdates/Introduction/Intro.html) from last year's WWDC) is to add more rows... you might find that easier. – rickster Mar 22 '12 at 06:22
  • +1 for you @rickster, then part 1 of the question is solved (In principle), then what about the part 2? – Scar Mar 22 '12 at 09:31
  • 1
    Well, there's no longer an internal table view, so the popover won't be from there. :) Probably the (formerly outer) table view is what you want. – rickster Mar 22 '12 at 16:01

1 Answers1

1

//when btn of custom cell is pressed

if(![tempPopover isPopoverVisible])
{

    UIButton* btn=(UIButton *)sender;
    NSIndexPath*indexpath=[NSIndexPath indexPathForRow:btn.tag inSection:0];
    cell=(customCell *)[tableView cellForRowAtIndexPath:indexpath];

        popoverController *objView = [[popoverController alloc] init];

        tempPopover = [[UIPopoverController alloc] initWithContentViewController:objView];
        [tempPopover setPopoverContentSize:CGSizeMake(160, 160)];
        [tempPopover presentPopoverFromRect:CGRectMake(655, cell.contentView.frame.origin.y-105, 150, 150) inView:cell.contentView permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];

}
bool.dev
  • 17,508
  • 5
  • 69
  • 93
Sachin
  • 47
  • 3
  • 10