問題描述
Bộ sưu tập xem vấn đề thay đổi kích thước iPhone 4 và iPhone 5 (Collection view resizing issue iPhone 4 vs iPhone 5)
I have a collection controller inside a view.
The collection controller does not cover 40 px at the top of the screen so that I can put buttons there.
On the iphone 4 it looks like this (proper way): Blue is the collection view, Red is the cell
However on the iPhone 5 it looks like this and I am not really sure why it won't spread and cover the blue parts
The interface builder for this looks like:
Collection view:
Collection view cell
Any help will be greatly appreciated, thanks
參考解法
方法 1:
Your Collection View has a fixed size. Do you have AutoLayout enabled? If yes, simply go to the iPhone 5's view and adjust the size so that it fits the iPhone 5 constraints. After that it should automatically size to iPhone 5 and iPhone <5
Constraints: InterfaceBuilder will do some 'magnetic' behavior if you reach these constraints.
(by William Falcon、mr.VVoo)