0

Here is all my code :

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

}

The TableViewController code is:

- (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{

}

Just use the most simplest way to use UITableView,and implement scrollViewDidScroll when I scroll the UITableView to the bottom and then popViewControllerAnimated i got crash. is this BUG of IOS? or where did i go wrong?

4

2 回答 2

1

scrollViewDidScroll问题是,tableview在动画 viewController 期间尝试访问委托方法。所以在底部滚动后,在popViewController之前设置datasourcedelegateNil。

于 2013-11-11T09:02:22.687 回答
0

试试这样

ExampleviewController *example=[[ExampleviewController alloc]]init];

[self.navigationController pushViewController:示例动画:YES];

检查 UIScrollView Delegate 是否声明

于 2013-11-11T05:22:48.643 回答