Unable to navigate to a controller using the UIPopoverPresentationController _passthroughViews method in iOS using Objective C.
I am trying to navigate to the controller view using the UIPopoverPresentationController's passthroughView. But I can't able to set this navigation and get an error and the app gets crashed. How can I resolve this?
Here I am additionally facing an error with the last item in the popover shows as a footer or not movable label and if I click this, there is no highlights, Code:
SelectorViewController* sv = [[SelectorViewController alloc] initWithStyle:UITableViewStylePlain];
sv.delegate = self;
sv.currentTopic = self.title;
NSLog(@" sv.currentTopic%@", sv.currentTopic);
sv.preferredContentSize = CGSizeMake(300, 500);
sv.modalPresentationStyle = UIModalPresentationPopover;
UIPopoverPresentationController *popoverpresentationController = sv.popoverPresentationController;
popoverpresentationController.delegate = self;
popoverpresentationController.sourceView = sender.view;
[self present view controller:sv animated: YES completion: nil];
popover.delegate = self;
if ([popover respondsToSelector:@selector(setBackgroundColor:)])
popover.backgroundColor = [UIColor whiteColor];
[sv release];
It seems you're trying to present a popover from a view controller and setting passthroughViews to the navigation controller's delegate. The
passthroughViewsproperty ofUIPopoverPresentationControlleris an array of views.The correct usage should be:
If you want to navigate to another controller when the popover is presented, you can do that in the popover's delegate method,
popoverPresentationControllerDidDismissPopover.As for the issue where you're not able to interact with the content, make sure that the popover's
preferredContentSizeis big enough to display the tableview and its cells fully. Also, check the tableview'scontentSize.