I have a couple of animations in my app that involve changing the alpha value of different objects. These work great for fading the object in, but they never seem to work for fading to 0.
UIView.animateWithDuration(0.4,
delay: 0,
options: .CurveLinear & .AllowUserInteraction & .BeginFromCurrentState,
animations: {
cell.notesLabel.alpha = 0
}, completion: nil)
Basically, the transparency just switches straight for 100% to 0% instantly. If I increase the duration, it just takes longer to start the animation and then it does it instantly again.
Anyone have any ideas?
Entire Code:
let cell = tableView.cellForRowAtIndexPath(indexPath) as CustomTransactionTableViewCell
if cell.notesLabel.alpha == 100 {
UIView.animateWithDuration(0.4,
delay: 0,
options: .CurveLinear | .AllowUserInteraction | .BeginFromCurrentState,
animations: {
cell.notesLabel.alpha = 0
}, completion: { (finished:Bool) in
UIView.animateWithDuration(1,
delay: 0,
options: .CurveLinear & .AllowUserInteraction & .BeginFromCurrentState,
animations: {
cell.paymentArrowImage.frame.origin.x = cell.paymentArrowImage.frame.origin.x - 400
cell.creditArrowImage.frame.origin.x = cell.creditArrowImage.frame.origin.x - 400
cell.paymentNameLabel.frame.origin.x = cell.paymentNameLabel.frame.origin.x + 400
cell.dateLabel.frame.origin.x = cell.dateLabel.frame.origin.x + 400
cell.costLabel.frame.origin.x = cell.costLabel.frame.origin.x - 400
}, completion: nil)
})
} else {
UIView.animateWithDuration(0.4,
delay: 0,
options: .CurveLinear & .AllowUserInteraction & .BeginFromCurrentState,
animations: {
cell.paymentArrowImage.frame.origin.x = cell.paymentArrowImage.frame.origin.x + 400
cell.creditArrowImage.frame.origin.x = cell.creditArrowImage.frame.origin.x + 400
cell.costLabel.frame.origin.x = cell.costLabel.frame.origin.x + 400
cell.paymentNameLabel.frame.origin.x = cell.paymentNameLabel.frame.origin.x - 400
cell.dateLabel.frame.origin.x = cell.dateLabel.frame.origin.x - 400
cell.notesLabel.alpha = 100
}, completion: nil)
}