NSLayoutConstraint needs mode that constrains to bottom when view is visible, top when hidden
| Originator: | kusterer | ||
| Number: | rdar://21181930 | Date Originated: | 01-Jun-2015 04:26 PM |
| Status: | Open | Resolved: | |
| Product: | OS X | Product Version: | Mac OS X 10.10.3 (14D136) |
| Classification: | Enhancement | Reproducible: | Always |
A very common use case I have is that I have e.g. a status text view, a progress bar view, and a pushbutton to Cancel. Now in most cases, the progress bar is invisible, because the operation is quick, but in a few cases, I need the progress bar. So I want the pushbutton to be at a certain distance below the status text when there's no progress bar, but want it to make room for the progress bar when that is visible. I would also like to be able to just do a binding to the "hidden" property on the progress bar to trigger this behaviour. Therefore, it would be great if there was a layout constraint that can be set on a view that binds to its bottom when the view is visible, but to its top when it is hidden (thus moving the bound view over the hidden one when needed). This would probably also have to ignore the value of "constant" in that case. Similarly, it would be good to have the same behaviour for left/right with leading/trailing alignments, and for left/right and right/left.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!