Adding constraints to Popup View on iOS #1979
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR resolves the issue where the Popup size does not change according to the change in the Popup content size.
Description of Change
Currently, there are no constraints, so it is not possible to change the size of the Popup in response to changes in the size of the Popup's content. First, add a constraint so that the ViewDidLayoutSubviews method is called as the Popup's content changes.
[src\CommunityToolkit.Maui.Core\Views\Popup\MauiPopup.macios.cs]
Next, within the ViewDidLayoutSubviews method, call methods to resize and layout the Popup.
[src\CommunityToolkit.Maui.Core\Views\Popup\MauiPopup.macios.cs]
With this fix, the size of the Popup itself will change according to the change in the size of the Popup's Content.
Linked Issues
PR Checklist
approved
(bug) orChampioned
(feature/proposal)main
at time of PRAdditional information
Below is the verification video. For verification, we used the source code provided in Issue #1974.
iPhone.15.iOS.17.0.2024-06-25.11-24-23.mp4
You can see that the size of the Popup itself changes according to the change in the size of the Popup's Content.
The following is the verification result when HorizontalOptions and VerticalOptions are set to End.
iPhone.15.iOS.17.0.2024-06-25.11-36-27.mp4
The following is the verification result when HorizontalOptions and VerticalOptions are set to Start.
iPhone.15.iOS.17.0.2024-06-25.11-38-25.mp4
You can see that both cases give the expected results.
The following is the verification result when the Popup size is explicitly specified as (300, 300).
iPhone.15.iOS.17.0.2024-06-25.11-42-02.mp4
You can see that the size of the Popup itself does not change as the size of the Popup's Content changes, and that the size specified for the Popup takes precedence.