Post

Replies

Boosts

Views

Activity

Correct way of inserting Audio Unit views into Auto Layout
Hi, I'm struggling getting Auto Layout to play nice with views returned by AUv3 Audio Units. All I'm trying to do is to insert them into an existing view hierarchy in such a way that they get displayed in a nice way. The sample code here on gitHub - https://github.com/hairer/MinimalAU.git loads an Audio Unit, adds its view to a container view, deactivates translatesAutoresizingMaskIntoConstraints, pins the AU's view to the container, and adds a size constraint. That size constraint then gets updated in viewWillLayout to match the requested size of the Audio Unit view. This works perfectly fine for AUv2 Audio Units, but when I load an AUv3 Audio Unit (in particular the one created by Apple's sample code), it typically collapses to something tiny. Furthermore, its controller returns very small values for its preferredContentSize, so that's not usable either. I've tried dozens of variations on this theme, but none of them seems to work. I am aware that I could simply fix the view size after checking for a few options with supportedViewConfigurations, but that feels like shooting in the dark and it still won't give me reasonable bounds between which to allow the view to resize... Did anyone here manage to solve this problem or could anyone at Apple weigh in on the preferred way to achieve this?
4
0
1.1k
Jun ’20