UITableView in popover doesn't stop scrolling

I have a UITableView displayed in a popover. One cell in my table view has a UITextField. When the text box is being edited (keyboard is visible) and I rotate the device from portrait to landscape and then try to scroll through the table view, it keeps going outside of it, instead of stopping and "bouncing".

Does anyone know how to fix this?

+2


a source to share


2 answers


You can try to detect when the device is rotated and call the tableViewController method, which adjusts the scroll position of the selected cell to the desired area.



0


a source


You can use the following code when rotating your device

     - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
      {

        if ([appDelegate.aPopover isPopoverVisible])
       {
        [appDelegate.aPopover dismissPopoverAnimated:NO];

        CGSize size = [self rotatedSize];
        size.height -= [[self.view viewWithTag:154] frame].size.height;

        appDelegate.aPopover.popoverContentSize = size;

        [appDelegate.aPopover presentPopoverFromRect:[[self.view viewWithTag:154] frame]
                                              inView:self.view
                            permittedArrowDirections:UIPopoverArrowDirectionDown
                                            animated:YES];
    }
}

       // for set popoverview size when rotate screen
         -(CGSize)rotatedSize
         {
         UIDeviceOrientation orientation1 = [[UIDevice currentDevice] orientation];
         UIInterfaceOrientation toInterfaceOrientation =  orientation1;
         if ((toInterfaceOrientation == UIInterfaceOrientationPortrait) || (toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown))
        {
              return self.view.frame.size;
      }
    else
    {
        return CGSizeMake(self.view.frame.size.height, self.view.frame.size.width);
    }
}

      



Thanks,

0


a source







All Articles