ZBSTools
更方便、更流畅地使用Swift
* ZBSImagePickerManager
是对UIImageUIImagePickerController和UIImagePickerControllerDelegate的封装。
您可以像这样简单地从相机获取图片:
ZBSImagePickerManager.shared.launchImagePickerIn(controller: viewController, sourceType: .camera) { (image) in
//TODO:do something with image;
}
如果您想从相机获取图片,必须在info.plist中添加NSCameraUsageDescription;
* ZBSAlertController
是UIAlertController的子类,可以减少显示简单提示视图的代码量;
您可以在控制器中如下显示一个提示视图:
ZBSAlertController.simple2optionsAlertViewWith(name: "title", message: "message", yesButtonName: "Done", yesButtonAction: { (action) in
//Done action code
}, noButtonName: "Cancel", noButtonAction: { (action) in
//Cancel action code
}).presentedIn(self, animated: true) {
//present completed code
}
CocoaPods
pod 'ZBSTools', '~> 0.0.2'