Ipad popover tableview显示然后消失

Ipad popover tableview显示然后消失,ipad,uitableview,uipopovercontroller,Ipad,Uitableview,Uipopovercontroller,点击一个按钮,我会显示一个popover视图,它是一个tableview 一切似乎都正常,视图显示,但不到一秒钟就消失了 tableview包含一个字符串列表,我将tablecell设置为show复选标记 我注意到该表在显示的瞬间显示了所有选中的项 谁都知道我错过了什么 谢谢 哈桑 显示popover的代码 - (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifi

点击一个按钮,我会显示一个popover视图,它是一个tableview

一切似乎都正常,视图显示,但不到一秒钟就消失了

tableview包含一个字符串列表,我将tablecell设置为show复选标记

我注意到该表在显示的瞬间显示了所有选中的项

谁都知道我错过了什么

谢谢

哈桑

显示popover的代码

- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.identifier isEqualToString:@"WholesalersList"]){
        AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

        WholesalersViewController *vc = segue.destinationViewController;
        vc.wholesalers = [appDelegate.wholesalers mutableCopy];
        if ([segue isKindOfClass:[UIStoryboardPopoverSegue class]]){
            self.wholesalersPopoverController = [(UIStoryboardPopoverSegue *)segue popoverController];
            [self.wholesalersPopoverController setPopoverContentSize:CGSizeMake(334, 334)];
            //[self.wholesalersPopoverController setDelegate:self];
        }
    }
}
popover表视图中的代码

#pragma mark Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)theTableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)theTableView numberOfRowsInSection:(NSInteger)section {
    if ([self.wholesalers count] == 0) {
        return 1;
    }
    else {
        return [self.wholesalers count];
    }
}

#pragma mark Table view delegate
- (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    if ([self.wholesalers count] == 0) {
        return nil;
    }
    else {
        static NSString *CellIdentifier = @"WholesalerCell";

        UITableViewCell *cell = [theTableView dequeueReusableCellWithIdentifier:CellIdentifier];

        // Configure the cell.
        Wholesaler *ws = (Wholesaler *)[self.wholesalers objectAtIndex:indexPath.row];

        cell.textLabel.text = ws.name;

        return cell;
    }
}

- (CGFloat)tableView:(UITableView *)theTableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 44;
}

- (void)tableView:(UITableView *)theTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
}

- (void)tableView:(UITableView *)theTableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
}

- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    return NO;      // The table view should not be re-orderable.
}

正在调用dismissPopover:在代码中的任意位置设置动画,例如错误地将IBAction方法用于按钮,或者您没有IBAction方法?

没有代码,我们如何帮助您?使用代码更新问题。谢谢你,感谢上帝让代码看起来更好。非常好的发现!非常感谢。我在IBActionif(self.whistalersPopOvercontroller==nil){[self-performsguewithidentifier:@“whistalerslist”发送者:self];}其他{[self.whistalersPopOvercontroller dismissPopoverAnimated:YES];self.whistalersPopOvercontroller=nil;}我仍然不知道为什么执行else部分。这是因为当我把它评论出来时,它是有效的。谢谢你发现了H