When using Segues in Messages Extension Application the layout gets messed up.
Is there any way to solve this issue while still using storrybord segues?
Screenshots:
(Note: The first and second View / ViewController are identical. The segue-type doesn't matter)
Expanded Presentation Style:
Compact Presentation Style:
Update 1:
The top and bottom layout guides reset after a segue
- compact:
- top: should be: 0 but is: 20
- bottom: should be: 44 but is: 0
- expanded:
- top: should be: 86 but is: 20
- bottom: should be: 44 but is: 0
P.S. Can someone create a new "messages-extension" tag?
in my app, viewcontroller in .expand mode set :
in .compact mode set it to false
it should work.
One possible solution I arrived at with the help of http://sandmoose.com/post/35714028270/storyboards-with-custom-container-view-controllers
In your entry point view controller, place a container view that has auto layout constraints aligning the top and bottom of the container view to the top and bottom layout guides.
The container view itself then needs to embed any view controller that you segue to. This way destination view controllers will always live in the confines of the container view. The container view will also be constrained correctly by the top and bottom layout guides of the initial view controller.
One way to achieve this: Implement a protocol that will receive notifications for segues - something like:
Implement a subclass of UIViewController that has a reference to SegueDelegate e.g.
Have your initial messages view controller implement the protocol.
The containerViewController here must implement an embed method that swaps the displaying view controller with the new one e.g.
I hope this won't always be necessary, but I ended up using a combination of a constraint outlet, presentationStyle variable, and viewDidLayoutSubviews() to overcome this bug/oversight.
In my DetailViewController:
And in my MainViewController:
And in case it makes a difference, my segue presents modally as a Page Sheet.