在Swift中滑动动画

时间:2015-10-26 17:12:02

标签: ios swift uicollectionview swipe

我添加了两个手势,导致单元格UICollectionView上下。

func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
    let cell = collectionView.dequeueReusableCellWithReuseIdentifier(Storyboard.CellIdentifier, forIndexPath: indexPath) as! CardsCollectionViewCell

    cell.card = self.cards[indexPath.item]

    let UpSwipe = UISwipeGestureRecognizer(target: self, action: Selector("gestureToUp:"))
    UpSwipe.direction = UISwipeGestureRecognizerDirection.Up
    cell.addGestureRecognizer(UpSwipe)

    let downSwipe = UISwipeGestureRecognizer(target: self, action: Selector("gestureToDown:"))
    downSwipe.direction = UISwipeGestureRecognizerDirection.Down
    cell.addGestureRecognizer(downSwipe)


    return cell
}
func gestureToUp(sender: UISwipeGestureRecognizer){
    print("up")
}

func gestureToDown(sender: UISwipeGestureRecognizer){
    print("down")
}

我想添加一个等于轻扫的动画来删除电子邮件应用。 我试图做一些等于UITableViewController的事情,但似乎不允许这样做,而且我读到的关于它的文章没有显示UICollectionView的单元格。

有些人可以帮助我吗?

0 个答案:

没有答案