I have this app that was previously developed and maintained at Xcode 7. But recently we had to upgrade Xcode to 10 to be able to post the app to apple store.
Many layout were broken upon the update and this seems to be a known issue ref. I believe it is the AutoLayout problem. I fixed them by going to storyboard to add the required constraints.
However there is a problem with one of the popovercontroll that I do not know how to fix.
Here is how it look after the upgrade:
The popover is not showing.
The code has not changed. It is a custom table view controller inherited from UITableViewController
. I tried update frame but it did not work.
The code that should pop up the view:
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
UNISortTableViewController *contentViewController = [storyBoard instantiateViewControllerWithIdentifier:@"UNISortTableViewController"];
((UNISortTableViewController *)contentViewController).sortKeyArray = [NSArray arrayWithObjects:@"1", @"2", @"3", @"4", @"5", nil];
[(UNISortTableViewController *)contentViewController setPreviousSortKeyIndex:sortKeyIndex];
[(UNISortTableViewController *)contentViewController setPreviousSortOrder:ascIssues];
self.popoverController = [[popoverClass alloc] initWithContentViewController:contentViewController];
if ([self.popoverController respondsToSelector:@selector(setContainerViewProperties:)]) {
[self.popoverController setContainerViewProperties:[self improvedContainerViewProperties]];
}
self.popoverController.delegate = self;
contentViewController.delegate = self;
[self.popoverController presentPopoverFromBarButtonItem:sender
permittedArrowDirections:(UIPopoverArrowDirectionUp|UIPopoverArrowDirectionDown|
UIPopoverArrowDirectionLeft|UIPopoverArrowDirectionRight)
animated:YES];
When debug I can see that cellforrowatindexpath
event is not called
Your antiquated code is calling initWithContentViewController
. This suggests that you are using UIPopoverController, which was deprecated after iOS 9.
You need to modernize your approach to popovers. Nowadays, popovers are simply a variety of presented view controller. There is no such thing as a UIPopoverController any more. You just call presentViewController
on a normal UIViewController with a modalPresentationStyle
of UIModalPresentationPopover
. The entire way you designate where the arrow goes has changed too, but I won't go into detail, as the full information is available in the docs and elsewhere.