Programmatically implementing two different layouts using size classes

前端 未结 4 1746
清歌不尽
清歌不尽 2021-01-30 16:54

I have a four buttons layout. In portrait they should be shown one above the other. In landscape they should be in two columns each with two buttons.

I implement the but

4条回答
  •  無奈伤痛
    2021-01-30 17:00

    Swift 4 code for the accepted answer:

    if (self.view.traitCollection.horizontalSizeClass == .compact) {
    ...
    }
    

提交回复
热议问题