For an app that has many UI elements, such as the piano keyboard, adding constraints to it using Interface Builder may be complicated. Adding one by one? On no, I can't do that. So is there a better way to add so many constraints? Programmatically?
Yes, there are many examples out there of adding autolayout constraints programmatically. See:
Adding Constraints Programmatically on iOS
or
Swift | Adding constraints programmatically
for example.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.