什么改变了我的图层位置
What change my layer position
我有一个 TDHomeCollectionHeaderView,我在它的 initWithFrame
中设置了 zposition=-999。但是我发现 drawRect.What 中的 zPosition 是 1 发生了什么?什么改变了我的图层位置? TDHomeCollectionHeaderView 是 UICollectionView 的 SupplementaryView。
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self addSubview:self.imageView];
[self addSubview:self.iconView];
[self addSubview:self.label];
self.userInteractionEnabled = NO;
self.layer.zPosition = -999;
}
return self;
}
-(void)drawRect:(CGRect)rect
{
//here zposition is 1
NSLog(@"TDHomeCollectionHeaderView %f",self.layer.zPosition);
}
是雷达http://www.openradar.me/34308893. A better around is suggested in this Whosebug reply:"Set the header view layer's zPosition in willDisplaySupplementaryView".(UICollectionView fails to honour zPosition and zIndex - iOS 11 only)
我有一个 TDHomeCollectionHeaderView,我在它的 initWithFrame
中设置了 zposition=-999。但是我发现 drawRect.What 中的 zPosition 是 1 发生了什么?什么改变了我的图层位置? TDHomeCollectionHeaderView 是 UICollectionView 的 SupplementaryView。
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self addSubview:self.imageView];
[self addSubview:self.iconView];
[self addSubview:self.label];
self.userInteractionEnabled = NO;
self.layer.zPosition = -999;
}
return self;
}
-(void)drawRect:(CGRect)rect
{
//here zposition is 1
NSLog(@"TDHomeCollectionHeaderView %f",self.layer.zPosition);
}
是雷达http://www.openradar.me/34308893. A better around is suggested in this Whosebug reply:"Set the header view layer's zPosition in willDisplaySupplementaryView".(UICollectionView fails to honour zPosition and zIndex - iOS 11 only)