应用程序在打开UIPopoverController时崩溃

时间:2012-10-12 12:03:34

标签: iphone objective-c uitableview

我正在打开一个 .xib文件,其UITableView中包含一个UIPopViewController,我已经提供了UIATableView的数据源和委托方法。

但在调用cellForRowAtIndexPath方法后,我的应用程序崩溃了。

我的代码如下:

- (IBAction)btnOilChangePressed:(id)sender {
    OilChangeView *oilVC = [[OilChangeView alloc] initWithNibName:@"OilChangeView" bundle:nil];

       UIPopoverController *popView = [[UIPopoverController alloc] initWithContentViewController:oilVC];

        [popView setPopoverContentSize:CGSizeMake(480, 250)];
        [popView presentPopoverFromRect:btnOilChange.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];

}

以下是OilChangeView.m文件中的代码

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [arrayInfo count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
    }


    cell.textLabel.text = [arrayInfo objectAtIndex:indexPath.row];
    NSLog(@"text:%@",[arrayInfo objectAtIndex:indexPath.row]);
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

    // Configure the cell...

    return cell;
}

帮助我...

0 个答案:

没有答案