在popover中选择的行应该添加到uitableview吗?

时间:2013-04-19 10:54:55

标签: ios ipad uitableview popover

当用户从表中选择第一行时,会出现 popover 吗?

当用户从弹出窗口中选择任何一行时,应将单元格添加到相应的表格中,即弹出窗口的表格?我怎么能这样做?

third = nil;
self.colorPickerPopover = nil;
UITableViewCell *cell= [tableView cellForRowAtIndexPath:indexPath];
CGRect rect=CGRectMake(cell.bounds.origin.x+300, cell.bounds.origin.y+10, 10, 10);
if (indexPath.section ==0) {
    if (indexPath.row == 0 ) {
        if (third == nil) {
            third  = [[ThirdViewController alloc] initWithStyle:UITableViewStylePlain];
            UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController:third];
            self.colorPickerPopover = [[UIPopoverController alloc] initWithContentViewController:controller] ;
            [colorPickerPopover setDelegate:self];
            [self.colorPickerPopover presentPopoverFromRect:rect inView:cell permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
            UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStylePlain target:self action:@selector(cancelClicked)];
            [[UINavigationBar appearance] setTintColor:[UIColor darkGrayColor]];
            third.navigationItem.leftBarButtonItem = closeButton;
            UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStylePlain target:self action:@selector(doneClicked)];
            [[UINavigationBar appearance] setTintColor:[UIColor darkGrayColor]];
            third.navigationItem.rightBarButtonItem = doneButton;
        }

1 个答案:

答案 0 :(得分:0)

当你的popover在那个时候解散时,用这个新的元素数组重新加载你的tableview,这样就可以尝试这个。

EDIT:

获取一个用于在tableview上显示数据的数组,当你解除当时的pop概述时,将所选元素添加到该tableview arrayan中,然后使用新的tableview数组重新加载tableview。