直接看代码:
<span style="font-size:18px;">UIView.transitionFromView(graphView,toView:counterView,duration: 0.5,options: UIViewAnimationOptions.ShowHideTransitionViews | UIViewAnimationOptions.TransitionFlipFromRight,completion:nil)</span>
今天要写个控件动画的时候写在这句,突然发现编译器报错Binary operator “|”cannot be applied to two operands,也就是说不能再用"|"符号来为option这个参数应用两个value了,不用慌,翻了翻资料听说swift这次改版后建议使用OptionSetType,OK,直接了当改成如下:
<span style="font-size:18px;">UIView.transitionFromView(counterView,toView:graphView,options:UIViewAnimationOptions.ShowHideTransitionViews.union(UIViewAnimationOptions.TransitionFlipFromRight),completion: nil)</span>使用union应用两个value毫无违和感。
<span style="font-size:18px;">UIApplication.sharedApplication().registerUserNotificationSettings(UIUserNotificationSettings(forTypes: [.Alert,.Badge],categories: nil))</span>
<span style="font-size:18px;">UIView.transitionFromView(graphView,options: [UIViewAnimationOptions.ShowHideTransitionViews,UIViewAnimationOptions.TransitionFlipFromRight],completion:nil)</span>成功通过编译并且完美实现,这种写法能应对传入多个value并且非常有格式性