你好~在原OC版本中
453行代码中
if (([self isKindOfClass:[UITableView class]] || [self isKindOfClass:[UICollectionView class]]) && self.subviews.count > 1) {
[self insertSubview:view atIndex:0];
}
else {
[self addSubview:view];
}
这里是只有当UITableView和UICollectionView的时候才走 self.subviews.count 的逻辑
你的swift版本是
if (self is UITableView) || (self is UICollectionView) || (subviews.count > 1) {
insertSubview(view, at: 0)
} else {
addSubview(view)
}
你这里面全是用的 || 导致如果是UIScrollView 使用,强制显示会始终显示在最下层,本身我的UIScrollView可能会有一些基础view元素,我只需要这个缺省页帮我遮住就行了
你好~在原OC版本中
453行代码中
if (([self isKindOfClass:[UITableView class]] || [self isKindOfClass:[UICollectionView class]]) && self.subviews.count > 1) {
[self insertSubview:view atIndex:0];
}
else {
[self addSubview:view];
}
这里是只有当UITableView和UICollectionView的时候才走 self.subviews.count 的逻辑
你的swift版本是
if (self is UITableView) || (self is UICollectionView) || (subviews.count > 1) {
insertSubview(view, at: 0)
} else {
addSubview(view)
}
你这里面全是用的 || 导致如果是UIScrollView 使用,强制显示会始终显示在最下层,本身我的UIScrollView可能会有一些基础view元素,我只需要这个缺省页帮我遮住就行了