Reputation: 201
I am using constraints to lay out a view controller in my app. Here is a screenshot of the completed layout:
From what I've read, the constraints being blue means they are good (there is enough information to determine layout).
In another view controller, I am presenting this view controller with a popover presentation style like this:
- (void)annotationTapped:sender {
...
AJFAnswerViewController *answerViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"AnswerViewController"];
answerViewController.modalPresentationStyle = UIModalPresentationPopover;
[self presentViewController:answerViewController animated:YES completion:nil];
answerViewController.answerLabel.text = tappedAnnotation.name;
answerViewController.quesitonLabel.text = tappedAnnotation.questionText;
answerViewController.saveBlock = saveBlock;
UIPopoverPresentationController *popover = [answerViewController popoverPresentationController];
popover.sourceView = tap.view;
popover.sourceRect = tap.view.bounds;
popover.permittedArrowDirections = UIPopoverArrowDirectionAny;
}
Here is what I see when I run the app:
It seems that the constraints are not being applied. I have verified that my storyboard ID is correct, and that the popover is using the view controller in the popover (for example, if I change the explicit height to something like 100, it is respected).
Am I missing a specific method call, or going about the storyboard layout wrong?
Upvotes: 2
Views: 116
Reputation: 64
Upvotes: 0
Reputation: 201
Resolved by applying the constraints to the wAny hAny size (as suggested by Dean, thanks!).
Upvotes: 1