AJPopAlert 0.1.0

AJPopAlert 0.1.0

Ajiejoy维护。



  • ajijoyo

AJPopAlert

CI Status Version License Platform

示例

要运行示例项目,首先克隆仓库,然后从示例目录中运行pod install

要求

Xcode 10+
Swift 4.2

安装

AJPopAlert可以通过CocoaPods获得。要安装它,只需将以下行添加到Podfile

pod 'AJPopAlert'

用法

默认警报

let vc = AJPopAlert(title: "Lorem Ipsum", message: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum",position:.bottom)
vc.addAction(title: "Ok") { (action) in
  print("ok")
}
vc.addAction(title: "Later") { (action) in
  print("later")
}        
vc.addAction(title: "Cancel", type: .destructive) { (action) in
  action.dismiss(animated: true, completion: nil)
}        
vc.show()

定制化

自定义视图

let customView = MyCustomView()
let vc = AJPopAlert(customView: customView)

vc.addAction(title: "Ok") { (action) in
     print("ok")
}
vc.addAction(title: "Later") { (action) in
     print("later")
}
 
vc.addAction(title: "Cancel", type: .destructive) { (action) in
     action.dismiss(animated: true, completion: nil)
}
        
vc.show()

自定义操作

确保你继承了 AJPopAction 并将传递给 addAction(popAction: <#T##AJPopAction#>)

class MyCustomAction : AJPopAction {
  init(){
    type = .normal
    
  }
}


//// in other class

let customView = MyCustomView()
let vc = AJPopAlert(customView: customView)

vc.addAction(title: "Ok") { (action) in
     print("ok")
}
vc.addAction(title: "Later") { (action) in
     print("later")
}
let action = MyCustomAction()
action.action = { (viewcontroller) in 
  print("DidTap")
}
vc.addAction(popAction:action)
        
vc.show()

文档

在Wiki标签中查看更多信息

作者

ajijoyo,[email protected]

许可证

AJPopAlert 在MIT许可证下可用。有关更多信息,请参阅LICENSE文件。