无法在集合视图IOS上隐藏图像
我正在使用集合视图,我想根据滚动结束检测隐藏和取消隐藏图像。但我无法隐藏图像。此外,我还想在选项卡栏上方显示图像。 此外,如何将图像始终放在选项卡栏上方,或集合视图中任意单元格的下方 我的代码:无法在集合视图IOS上隐藏图像,ios,objective-c,image,uicollectionview,Ios,Objective C,Image,Uicollectionview,我正在使用集合视图,我想根据滚动结束检测隐藏和取消隐藏图像。但我无法隐藏图像。此外,我还想在选项卡栏上方显示图像。 此外,如何将图像始终放在选项卡栏上方,或集合视图中任意单元格的下方 我的代码: @interface UIImageView *arrow; end @implementation - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(
@interface
UIImageView *arrow;
end
@implementation
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
arrow = [[UIImageView alloc]initWithFrame:CGRectMake(20, 320, 20, 20)];
arrow.image = [UIImage imageNamed:@"about"];
[collectionView insertSubview:arrow belowSubview:cell ];
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
float bottomEdge = scrollView.contentOffset.y + scrollView.frame.size.height;
if (bottomEdge >= scrollView.contentSize.height) {
arrow.hidden=YES;
}
}
end
确保创建的UIImageView不超过一个 可以在1和2处放置断点,以检查是否隐藏同一UIImageView对象 1:arrow.image=[UIImage ImageName:@“about”]
2:箭头。隐藏=是 调用
arrow.hidden=YES,您希望得到什么代码>?我想删除该图像。预期相同。哪个图像,您正在创建未知数量的图像,每个单元格至少一个,如果您向后滚动,则会创建更多。我只是在选项卡栏控制器上方创建一个图像。当向下滚动图像只是一个指示时,同样要隐藏。