By default, when you are using the flow layout in a collection view, cells are centered vertically. Is there a way to change this alignment ?
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Xcode: Is there a way to change line spacing (UI L
- Swift - hide pickerView after value selected
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
following code worked for me
@DongXu: Your solution worked for me too. Here is the Xamarin.iOS version if it:
@DongXu's answer is correct. However, I suggest to make those calculations in
UICollectionViewFlowLayout
'sprepare()
method. It will prevent multiple calculations on the same cell's attributes. Moreover,prepare()
is better place to manage attributes cache.I have used something similar to the before answers. In my case I want to align cells by colum with different heights.
This is the result of this layout: