用于基于 UIView 和 UIViewController 的动画的简单易用的动画库
部署目标 - iOS 8.0 或更高版本
RappleUIAnimator 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod "RappleUIAnimator"
Rajeev Prasad,[email protected]
RappleUIAnimator 可在 MIT 许可下使用。有关更多信息,请参阅 LICENSE 文件。
Objc ->
#import <RappleUIAnimator/RappleUIAnimator.h>
Swift ->
import RappleUIAnimator
首先添加一个全局变量以保持 RappleTransitionDelegate
var transitionDelegate : RappleTransitionDelegate?
然后创建您的视图控制器,在显示之前设置 transitioningDelegate
if let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("ModalViewController") as? ModalViewController {
transitionDelegate = RappleTransitionDelegate(viewController: vc, direction: RappleDirectionLeftToRight);
vc.transitioningDelegate = transitionDelegate
self.presentViewController(vc, animated: true, completion: nil)
}
使用消息和按钮标题及完成处理程序打开提示视图
let alert = RappleAlertView(message: "Rapple alert view is awsome!!!", cancel: "Cancel", ok: "OK");
alert.setAttributes([RappleAlertButtonTextColor : UIColor.whiteColor(), RappleAlertButtonPanelColor : RappleColor.rappleBlue()])
alert.show { (button) -> Void in
if button.value == RappleAlertCancelButton.value {
println("Cancel Tapped") ;
} else if button.value == RappleAlertOKButton.value {
println("OK Tapped")
}
}
首先添加一个全局变量以保持 RapplePOPView
var pop : RapplePOPView?
然后创建您的视图控制器,并用 RapplePOPView 设置和打开
if let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("RapplePOPViewController") as? RapplePOPViewController {
vc.popDelegate = self
pop = RapplePOPView(customViewController: vc, size: CGSizeMake(300, 400))
pop!.delegate = self
pop!.setBorderColor(UIColor.lightGrayColor(), borderWidth: 2)
pop!.show()
}