-
1 先看看我们的gif
Camera.gif
一行代码集成 该类函数必须是继承 UIViewController
//方式一
CommonFunction.CameraPhotoAlertController(self) { (img) in
print(img)
}
//方式二
self.ShowCameraPhotoSheet { (value) in
print(value)
}
如果想重写相机选中后的图片处理,可以重写已拓展好的类
我们看看 UIViewController 已经做好了相机的拓展
extension UIViewController:SKStoreProductViewControllerDelegate,UIImagePickerControllerDelegate, UINavigationControllerDelegate
如果需要重写“相机”或"取消",代码如下:
//相机选择图片后
override func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
}
//选择取消
override func imagePickerControllerDidCancel(picker: UIImagePickerController) {
picker.dismissViewControllerAnimated(true, completion: nil)
}
如需代码,请移动到--->http://www.jianshu.com/p/0f950c180cb8
网友评论