2016-09-21 76 views
0

我有问题与代码块:预计表达错误雨燕3.0

private static func replaceAnimationMethods() { 
     //replace actionForLayer... 
     method_exchangeImplementations(
      class_getInstanceMethod(self, #selector(UIView.actionForLayer(_:forKey:))), 
      class_getInstanceMethod(self, #selector(UIView.EA_actionForLayer(_:forKey:)))) 

     //replace animateWithDuration... 
     method_exchangeImplementations(
      class_getClassMethod(self, #selector(UIView.animateWithDuration(_:animations:))), 
      class_getClassMethod(self, #selector(UIView.EA_animateWithDuration(_:animations:)))) 
     method_exchangeImplementations(
      class_getClassMethod(self, #selector(UIView.animateWithDuration(_:animations:completion:))), 
      class_getClassMethod(self, #selector(UIView.EA_animateWithDuration(_:animations:completion:)))) 
     method_exchangeImplementations(
      class_getClassMethod(self, #selector(UIView.animateWithDuration(_:delay:options:animations:completion:))), 
      class_getClassMethod(self, #selector(UIView.EA_animateWithDuration(_:delay:options:animations:completion:)))) 
     method_exchangeImplementations(
      class_getClassMethod(self, #selector(UIView.animateWithDuration(_:delay:usingSpringWithDamping:initialSpringVelocity:options:animations:completion:))), 
      class_getClassMethod(self, #selector(UIView.EA_animateWithDuration(_:delay:usingSpringWithDamping:initialSpringVelocity:options:animations:completion:)))) 

    } 

我想迁移到雨燕3.0。

为:

class_getClassMethod(self, #selector(UIView.animate(withDuration:animations:)(_:animations:))), 

我收到错误Expected expression in list of expressions

为:

class_getClassMethod(self, #selector(UIView.animate(withDuration:animations:completion:)(_:animations:completion:))), 

我陷入了想法如何解决这个错误Expected ',' separator

。任何指针将非常感激。

回答

0

你有没有试过像下面的语法。

class_getClassMethod(self, #selector(UIView.animate(withDuration:animations:))) 
class_getClassMethod(self, #selector(UIView.animate(withDuration:animations:completion:)))