Быстрый просмотр UIView с несколькими вариантами
Как быстро обрабатывать несколько параметров при анимации UIView? Я попробовал
UIView.animateWithDuration(0.2, delay: 0.0, options: .Repeat | .Autoreverse, animations: {self.alpha = 0.0}, completion: nil)
но, похоже, путает |
с поразрядным оператором:
Undefined symbols for architecture i386:
"__TFSsoi1oUSs17_RawOptionSetType_USs21BitwiseOperationsTypeSs9Equatable__FTQ_Q__Q_", referenced from:
__TFC17TextDrawing10cursorViewW8blinkingSb in cursorView.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Я использую последнюю версию Xcode из AppStore.
Ответы
Ответ 1
Swift 2:
UIView.animateWithDuration(0.2, delay: 0.0, options: [.Repeat, .Autoreverse], animations: {self.alpha = 0.0}, completion: nil)
Swift 3, 4, 5
UIView.animate(withDuration: 0.2, delay: 0.0, options: [.repeat, .autoreverse], animations: {self.alpha = 0.0}, completion: nil)
Ответ 2
Предварительный просмотр не будет работать в текущем быстром режиме. Хороший ответ дал @mxcl.
Если, несмотря на все, что вы хотите использовать эту форму, вам необходимо восстановить rawValue и перестроить новый UIViewAnimationOptions с помощью маски include.
UIViewAnimationOptions(rawValue:(UIViewAnimationOptions.Autoreverse.rawvalue | UIViewAnimationOptions.Repeat.rawValue))
Ответ 3
Swift 3:
Протестировано и нормально:
UIView.animate(withDuration: 0.2, delay: 0.0, options: [.repeat, .autoreverse], animations: {
}, completion: nil)
Ответ 4
Из docs похоже, что вы делаете правильно?
Вы пробовали обертывать опции в круглых скобках?
Либо это, либо сначала введите параметры в переменную и попробуйте это?
Ответ 5
Это рабочий код для меня:
UIView.animateWithDuration(0.5, delay: 0.0, options: UIViewAnimationOptions.Autoreverse | UIViewAnimationOptions.Repeat, animations: { () -> Void in
disc.layer.transform = CATransform3DMakeScale(1.0, 1.0, 1.0)
}) { (success) -> Void in
}