Ipad UITableView无法在didselectRowAtIndexPath之后向下滚动

Ipad UITableView无法在didselectRowAtIndexPath之后向下滚动,ipad,uiscrollview,scroll,uitableview,Ipad,Uiscrollview,Scroll,Uitableview,我在iPAD上有一个UITableViewController,当我第一次加载tableview时,我可以滚动到底部,但是如果用DidSelectRowatineXpath选择一个单元格,我就不能再滚动到底部了,tableview一直在反弹,这是一个非常奇怪的行为。我放了一些日志来获取所有帧/边界/contentSize/contentInset/contentOffset。 每次点击桌子高度都会不断增加,我不知道如何解决这个问题 if(UI_USER_INTERFACE_IDIOM() ==

我在iPAD上有一个UITableViewController,当我第一次加载tableview时,我可以滚动到底部,但是如果用DidSelectRowatineXpath选择一个单元格,我就不能再滚动到底部了,tableview一直在反弹,这是一个非常奇怪的行为。我放了一些日志来获取所有帧/边界/contentSize/contentInset/contentOffset。 每次点击桌子高度都会不断增加,我不知道如何解决这个问题

 if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    {
            if ([self.navigationController.parentViewController isKindOfClass:[UISplitViewController class]]) {

            // iPad split view controller support
            UISplitViewController *split = (UISplitViewController *)self.navigationController.parentViewController;

            NSMutableArray *allControllers = [[NSMutableArray alloc] initWithArray:split.viewControllers];
            NSArray *allControllersCopy = [allControllers copy];

            for(int i = 0;i < allControllersCopy.count;i++)
            {
                UIViewController *s = [allControllersCopy objectAtIndex:i];
                if ([s isKindOfClass:[UINavigationController class]]) {
                    NSLog(@"UINavigationController at index : %d",i);
                }
                NSLog(@"custom split : %@", s.title);

            }
            UINavigationController *nav = [split.viewControllers objectAtIndex:1];

            allControllers = [[NSMutableArray alloc] initWithArray:nav.viewControllers];

            for(int i = 0;i < allControllers.count;i++)
            {
                UIViewController *s = [allControllers objectAtIndex:i];
                if(![s isKindOfClass:[MVPTaskViewController class]])
                {
                    [nav popViewControllerAnimated:NO];

                }
            }
            self.nTaskViewController = [nav.viewControllers objectAtIndex:0];
            self.nTaskViewController.selectedTask = selectedTask;
            [self.nTaskViewController updateTask:self.nTaskViewController.selectedTask];

            NSIndexPath *cellAtIndexPath = [NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section];
            [self.tableView scrollToRowAtIndexPath:cellAtIndexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];

            NSLog(@"tableView frame height %f",self.tableView.frame.size.height);
            NSLog(@"tableView frame width %f",self.tableView.frame.size.width);

            NSLog(@"tableView contentSize height %f",self.tableView.contentSize.height);
            NSLog(@"tableView contentSize width %f",self.tableView.contentSize.width);

            NSLog(@"tableView content offset x %f - y %f",self.tableView.contentOffset.x, self.tableView.contentOffset.y);

        }

可能是罪魁祸首。

我找到了一个解决方案。我不知道这是否是解决问题的正确方法,但它确实有效

我在nsindepath*cellAtIndexPath=[nsindepath indexPathForRow:indepath.row-instation:indepath.section]之后添加了didselectrowatinexpath;[self.tableView ScrollToRowatineXpath:CellatineXpath atScrollPosition:UITableView ScrollPosition:是]


希望对其他人有所帮助我已经尝试过了,但没有成功。问题是,在第一次单击单元格后,uitableview高度会发生变化,并且我看不到列表的bootom,如果我尝试滚动,我会被反弹回来
2013-12-12 12:33:47.854 moveplanner[7604:70b] view will appear
2013-12-12 12:33:47.854 moveplanner[7604:70b] tableView frame height 648.000000
2013-12-12 12:33:47.854 moveplanner[7604:70b] tableView frame width 320.000000
2013-12-12 12:33:47.855 moveplanner[7604:70b] tableView contentSize height 2313.058105
2013-12-12 12:33:47.856 moveplanner[7604:70b] tableView contentSize width 320.000000
2013-12-12 12:33:47.856 moveplanner[7604:70b] tableView content offset x 0.000000 - y 0.000000

2013-12-12 12:33:47.934 moveplanner[7604:70b] viewDidAppear details
2013-12-12 12:33:55.470 moveplanner[7604:70b] UPDATE TASK
2013-12-12 12:33:55.471 moveplanner[7604:70b] SELECTED TASK : Switch home insurance
2013-12-12 12:33:55.494 moveplanner[7604:70b] tableView frame height 808.000000
2013-12-12 12:33:55.495 moveplanner[7604:70b] tableView frame width 320.000000
2013-12-12 12:33:55.496 moveplanner[7604:70b] tableView contentSize height 2313.058105
2013-12-12 12:33:55.496 moveplanner[7604:70b] tableView contentSize width 320.000000
2013-12-12 12:33:55.496 moveplanner[7604:70b] tableView content offset x 0.000000 - y 0.000000
First click on a cell

2013-12-12 12:33:57.546 moveplanner[7604:70b] UPDATE TASK
2013-12-12 12:33:57.546 moveplanner[7604:70b] SELECTED TASK : Recycle unwanted items
2013-12-12 12:33:57.547 moveplanner[7604:70b] tableView frame height 968.000000
2013-12-12 12:33:57.548 moveplanner[7604:70b] tableView frame width 320.000000
2013-12-12 12:33:57.549 moveplanner[7604:70b] tableView contentSize height 2313.058105
2013-12-12 12:33:57.549 moveplanner[7604:70b] tableView contentSize width 320.000000
2013-12-12 12:33:57.549 moveplanner[7604:70b] tableView content offset x 0.000000 - y 317.000000


Second click on a cell

2013-12-12 12:34:00.448 moveplanner[7604:70b] UPDATE TASK
2013-12-12 12:34:00.448 moveplanner[7604:70b] SELECTED TASK : Gas boiler service
2013-12-12 12:34:00.449 moveplanner[7604:70b] tableView frame height 1128.000000
2013-12-12 12:34:00.450 moveplanner[7604:70b] tableView frame width 320.000000
2013-12-12 12:34:00.451 moveplanner[7604:70b] tableView contentSize height 2313.058105
2013-12-12 12:34:00.451 moveplanner[7604:70b] tableView contentSize width 320.000000
2013-12-12 12:34:00.451 moveplanner[7604:70b] tableView content offset x -0.000000 - y 1185.000000

Third click on a cell

2013-12-12 12:34:09.852 moveplanner[7604:70b] UPDATE TASK
2013-12-12 12:34:09.852 moveplanner[7604:70b] SELECTED TASK : Change the locks 
2013-12-12 12:34:09.853 moveplanner[7604:70b] tableView frame height 1288.000000
2013-12-12 12:34:09.854 moveplanner[7604:70b] tableView frame width 320.000000
2013-12-12 12:34:09.854 moveplanner[7604:70b] tableView contentSize height 2313.058105
2013-12-12 12:34:09.855 moveplanner[7604:70b] tableView contentSize width 320.000000
2013-12-12 12:34:09.855 moveplanner[7604:70b] tableView content offset x -0.000000 - y 1025.000000
    [self.tableView scrollToRowAtIndexPath:cellAtIndexPath atScrollPosition:UITableViewScrollPositionTop animated:YES]; 
                CGRect tbFrame = [self.tableView frame];
                if (UIInterfaceOrientationIsPortrait(self.interfaceOrientation))
                {
                    tbFrame.size.height = 910;                    }
                else {
                     tbFrame.size.height = 655;

                }
[self.tableView setFrame:tbFrame];