0
我正在使用集合視圖,我想根據滾動結束檢測來隱藏和取消隱藏圖像。但我無法隱藏圖像。另外,我想在我的tabbar上方顯示圖像。 另外,我怎樣才能把我的圖像總是在標籤欄之上,或者在收藏視圖中的任何單元格下方。無法隱藏集合視圖上的圖像IOS
我的代碼:
@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
你期望從調用'arrow.hidden = YES;'得到什麼? –
我想刪除該圖像。期待相同。 – developer
哪張圖片,如果您向後滾動,您正在創造未知數量的圖片,每個細胞至少有一張圖片。 –