美文网首页
iOS 11下,collectionview的滚动条被Secti

iOS 11下,collectionview的滚动条被Secti

作者: summerNight | 来源:发表于2018-01-26 17:02 被阅读20次
Untitled.gif

右边的滚动条被遮住了

解决办法

UICollectionReusableViewlayerClass替换掉

.h的代码
#import <UIKit/UIKit.h>

@interface XXCollectionReusableView : UICollectionReusableView

@end


#ifdef __IPHONE_11_0
@interface CustomLayer : CALayer

@end
#endif
.m的代码

#import "XXCollectionReusableView.h"

@implementation XXCollectionReusableView

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
    }
    return self;
}

+(Class)layerClass
{
    return [CustomLayer class];
}

@end

#ifdef __IPHONE_11_0
@implementation CustomLayer

- (CGFloat) zPosition {
    return 0;
}

@end
#endif

swift的参考这里

相关文章

网友评论

      本文标题:iOS 11下,collectionview的滚动条被Secti

      本文链接:https://www.haomeiwen.com/subject/exswaxtx.html