UICollectionView 单元格。尝试为子视图设置动画

UICollectionView cell. trying to animate subviews

试图为集合视图单元格内的子视图设置动画,但只是在状态之间发生突然变化。

...

    func animate (){
    if self.signOut.hidden == false{
        UIView.animateWithDuration(0.2) {
            self.signOut.hidden = true
        }
    }else{
        UIView.animateWithDuration(0.2) {
            self.signOut.hidden = false
        }
    }

...

非常感谢任何提示!

您需要降低动画块内的 alpha 以使视图平滑消失

      UIView.animateWithDuration(0.33, delay: 0.0, options: [.CurveEaseInOut], animations: {
            self.signOut.alpha = 0.0
        }) { finished in
            self.signOut.hidden = true
        }