Reputation: 2684
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];
Upvotes: 0
Views: 105
Reputation: 917
It seems you're trying to present a popover from a view controller and setting passthroughViews to the navigation controller's delegate. The passthroughViews
property of UIPopoverPresentationController
is an array of views.
The correct usage should be:
// Assuming `view1` and `view2` are views that you want the user to interact with while the popover is visible
popoverpresentationController.passthroughViews = @[view1, view2];
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 preferredContentSize
is big enough to display the tableview and its cells fully. Also, check the tableview's contentSize
.
Upvotes: 0