File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Sources/SparrowKit/UIKit/Classes/Collection Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,10 @@ import UIKit
2929 */
3030open class SPCollectionReusableView : UICollectionReusableView {
3131
32+ // MARK: - Private
33+
34+ open var inhertHorizontalMarginsFromCollection : Bool = true
35+
3236 // MARK: - Init
3337
3438 public override init ( frame: CGRect ) {
@@ -48,5 +52,19 @@ open class SPCollectionReusableView: UICollectionReusableView {
4852 No need ovveride other init. Using one function for configurate view.
4953 */
5054 open func commonInit( ) { }
55+
56+ open override func layoutSubviews( ) {
57+ super. layoutSubviews ( )
58+ if inhertHorizontalMarginsFromCollection, let collectionView = self . superview as? UICollectionView {
59+ setLayoutMargins (
60+ . init(
61+ top: layoutMargins. top,
62+ left: collectionView. layoutMargins. left,
63+ bottom: layoutMargins. bottom,
64+ right: collectionView. layoutMargins. right
65+ )
66+ )
67+ }
68+ }
5169}
5270#endif
You can’t perform that action at this time.
0 commit comments