Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有 10 个视图,并希望通过制作一个视图集合来一次使他们的角落变圆。我不想一个一个地做它们必须有一个快捷方式来帮助我编写代码
您可以简单地调用forEach(_:)IBOutet Collectionview's cornerRadius并像这样更改每个,
forEach(_:)
view's
cornerRadius
views.forEach({ $0.layer.cornerRadius = 5.0 })
cornerRadius根据您的要求设置值。