简体   繁体   中英

Swift: rotate buttons in stackview

I am creating a Side Bar. I added a stack view for adding buttons, how ever I need to rotate them.

I have tried: button.transform = CGAffineTransform(rotationAngle: -.pi/2)

However that is not working correctly since the width and height are not rotating even though the text is.

This is what I would like to do:

Image

After trial and error I figured out that the best solution was to create a containerView , add the UIStackView as a subview and finally rotate the containerView

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM