ios - UIImagePicker Controller swift -
snapshotting view has not been rendered results in empty snapshot. ensure view has been rendered @ least once before snapshotting or snapshot after screen updates
i'm getting warning when used uiimagepickercontroller take photo camera.and couldn't set image image view
please follow code , apply in project according relevant place
func opencamera() { if(uiimagepickercontroller .issourcetypeavailable(uiimagepickercontrollersourcetype.camera)) { picker!.sourcetype = uiimagepickercontrollersourcetype.camera self .presentviewcontroller(picker!, animated: true, completion: nil) } else { let alertwarning = uialertview(title:"warning", message: "you don't have camera", delegate:nil, cancelbuttontitle:"ok", otherbuttontitles:"") alertwarning.show() } } func opengallary() { picker!.sourcetype = uiimagepickercontrollersourcetype.photolibrary self.presentviewcontroller(picker!, animated: true, completion: nil) } //pickerview delegate methods func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [nsobject : anyobject]) { picker .dismissviewcontrolleranimated(true, completion: nil) imageview.image=info[uiimagepickercontrolleroriginalimage] as? uiimage } func imagepickercontrollerdidcancel(picker: uiimagepickercontroller) { println("picker cancel.") }
Comments
Post a Comment