Set UIView's autoresizing mask programmatically?

前端 未结 5 1181
青春惊慌失措
青春惊慌失措 2021-02-01 00:56

I have to set autoresizingMask programmatically for UIView.

I don\'t know how to implement this.

5条回答
  •  难免孤独
    2021-02-01 01:19

    Swift 4.1:

    view.autoresizingMask = [.flexibleHeight, .flexibleWidth, .flexibleTopMargin, .flexibleRightMargin, .flexibleLeftMargin, .flexibleBottomMargin]
    

提交回复
热议问题