0

ここにすべての私のコードがあります:

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(pushTableViewController:)];
    self.navigationItem.leftBarButtonItem = leftItem;

}
- (void)pushTableViewController:(id)sender {
    TableViewController *tableViewController = [[TableViewController alloc]init];
    [self.navigationController pushViewController:tableViewController animated:YES];

}

TableViewControllerコードは次のとおりです。

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    UIBarButtonItem *myMessageButton = [[UIBarButtonItem alloc] initWithTitle:@"back" style:UIBarButtonItemStylePlain target:self action:@selector(myMessageButtonClicked:)];
    self.navigationItem.leftBarButtonItem = myMessageButton;
    UITableView *scrollTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain];
    scrollTableView.delegate = self;
    scrollTableView.dataSource = self;
    [self.view addSubview:scrollTableView];
}
- (void)myMessageButtonClicked:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{

}

最も簡単な使用方法を使用し、一番下までスクロールしてクラッシュ し たときにUITableView実装します。これはIOSのバグですか?またはどこで間違ったのですか?scrollViewDidScrollUITableViewpopViewControllerAnimated

4

2 に答える 2

1

問題は、viewControllerscrollViewDidScrollのアニメーション中に tableview がデリゲート メソッドにアクセスしようとすることです。そのため、一番下のスクロールに到達したら、popViewController の前にdatasourceandを Nil に設定します。delegate

于 2013-11-11T09:02:22.687 に答える