UICollectionView滑动以删除iOS目标c
我已经提到了这个链接 这是写在swift我已经完成了我的项目在目标c,所以我想继续在目标c 我有一个UICollectionView,它有一些标签。我的目标是在滑动UICollectionView单元格时显示两个按钮—删除和编辑按钮—我正在动态地向CollectionView提供数据 下面是我的代码-UICollectionView滑动以删除iOS目标c,ios,objective-c,iphone,uicollectionview,uicollectionviewcell,Ios,Objective C,Iphone,Uicollectionview,Uicollectionviewcell,我已经提到了这个链接 这是写在swift我已经完成了我的项目在目标c,所以我想继续在目标c 我有一个UICollectionView,它有一些标签。我的目标是在滑动UICollectionView单元格时显示两个按钮—删除和编辑按钮—我正在动态地向CollectionView提供数据 下面是我的代码- - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return 1; } -
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
return 1;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
//int i=[self.name count];
return 5;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
AllProCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
cell.buttondel.hidden=YES;
UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeGesture:)];
swipeGesture.direction = UISwipeGestureRecognizerDirectionLeft;
[cell addGestureRecognizer:swipeGesture];
cell.pcatelbl.text=[NSString stringWithFormat:@"test"];
return cell;
}
-(void) handleSwipeGesture:(UISwipeGestureRecognizer *) sender
{
NSLog(@"swipped");
}
我已经截获了滑动手势现在我如何移动单元格并显示两个按钮用于编辑和删除目的
当我刷卡我的收藏视图单元格时,我的日志被“刷卡”嗨,Akshay,这不是正确的收藏方式。如果你确实尝试过,你会达到你的要求,但是代码会很复杂。那么正确的方法是什么呢???@PhaniRaghuYou必须使用表视图来满足你的要求。我正在尝试你的要求。我用collectionview到达它。我会告诉你的。实际上问题是我有5-6个标签,而且这些值很大,所以我使用集合视图而不是tableview