0

单击按钮时,我将显示一个弹出视图,它是一个表格视图。

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

表格视图包含一个字符串列表,我将表格单元设置为显示复选标记。

我注意到该表显示了在它显示的瞬间检查的所有项目

任何人都知道我错过了什么。

谢谢

哈桑

显示弹出框的代码

- (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];
        }
    }
}

弹出表视图中的代码

#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.
}
4

1 回答 1

0

是否在代码中的任何位置调用了dismissPopover:Animated,例如错误地在按钮的IBAction方法中,或者您没有IBAction方法?

于 2013-07-15T22:04:17.387 回答