我需要这个网格布局,带有 Storyboard 的 View 结构。是不是更容易设置,还是我需要计算size/4,乘以index,计算中心X、Y坐标,每次旋转调整NSLayoutConstraint
? p>
您可以将 UIStackView
与默认垂直使用并在横向尺寸类中将其轴更改为水平,分布 Fill-Equally
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
if UIDevice.current.orientation == .portrait
{
self.stackV.axis = .vertical
}
else
{
self.stackV.axis = .horizontal
}
}
关于ios - 如何制作这个网格布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49388345/
欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) | Powered by Discuz! X3.4 |