UIPopover arrow not repositioned correctly on rotation

Originator:keith
Number:rdar://14995477 Date Originated:15-Sep-2013
Status:Closed Resolved:
Product:iOS SDK Product Version:iOS 7.0
Classification:UI/Usability Reproducible:Yes
 
Summary:
When presenting a popover controller from a collection view cell the popover arrow direction is not repositioned when the popover view is repositioned following a device rotation.

For example In a situation where the popover is originally positioned to the right of a cell with the arrow pointing left. On rotation if the popover is repositioned to the left of the cell the arrow remains pointing to the left when it should also have been repositioned to point right (see attached images).

Steps to Reproduce:
1. Create a new Xcode project targeted for the iPad with a storyboard containing a collection view controller embedded in a navigation controller. The precise configuration is not important, following steps provide one possible example setup. An Xcode project that reproduces the problem is attached.

2. Add custom classes for a UICollectionViewController and a UICollectionViewCell. The cell contains an IBOutlet to a UILabel.

3. Configure the collection view to use the default vertical layout and change the class to the custom subclass created in step 2. Configure the cell size to be 200 x 200, add a UILabel to the cell, set a value for the cell identifier and change the class to the custom collection view cell class created in the previous step. Connect to the UILabel to the outlet in the custom class.

4. In the view controller implement the UICollectionViewDataSource methods to return a single section, containing 100 cells and have each cell simply display the cell row number in the UILabel.

5. In the storyboard add a tap gesture recogniser to the collection view controller and configure for 2 taps with delayed begin/end. Connect to a method in the view controller which when triggered, selected the cell and presents a popover view controller. The content of the presented view controller is not important. The popover controller is presented from the frame of the tapped cell:

  [self.uylPopoverController presentPopoverFromRect:cell.frame
                              inView:self.collectionView
                              permittedArrowDirections:UIPopoverArrowDirectionAny
                              animated:YES];

6. To ensure the popover view is correctly repositioned on rotation implement the popover delegate method:

- (void)popoverController:(UIPopoverController *)popoverController willRepositionPopoverToRect:(inout CGRect *)rect inView:(inout UIView **)view

This method should return the updated (after rotation) frame of the selected cell.

Expected Results:
Double-tapping a cell shows the popover controller with an arrow pointing back to the selected cell. On rotation the popover view should be correctly repositioned so that the arrow is on the side of the selected cell and pointing towards the cell.

Actual Results:
For any popover which, on rotation, changes side relative to the tapped cell the arrow is incorrectly positioned. The popover view is correctly repositioned but the arrow remains in the same position as used prior to the rotation.

See attached images cellWithPopover.png and popoverWithWrongArrow.png. The second image is the result of rotating the device when showing the first image.

Comments

Closing as resolved in iOS 9.x

Issue is no longer present in iOS 9.3, not sure exactly when it was fixed.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!