swift - takePicture() with cameraOverlayView -
i'm using cameraoverlayview create custom camera. however, i'm not sure how make button shoot photo. apple docs takepicture()
function use. not compile:
neither attempt works:
let shootpicture = uibarbuttonitem(barbuttonsystemitem: uibarbuttonsystemitem.camera, target: self, action: takepicture()) let shootpicture = uibarbuttonitem(barbuttonsystemitem: uibarbuttonsystemitem.camera, target: self, { action -> void in takepicture() })
updated attempt:
let shootpicture = uibarbuttonitem(barbuttonsystemitem: uibarbuttonsystemitem.camera, style: uibarbuttonitemstyle.plain, target: self, action: "takepicture") // separate function func takepicture() { imagepicker.takepicture() }
still getting syntax error: missing argument parameter 'landscapeimagephone' in call
but when add landscapeimagephone: uibarbuttonsystemitem.camera
, "extra argument 'landscapeimagephone' in call"
for else stuck on this:
set bar item:
let shootpicture = uibarbuttonitem(barbuttonsystemitem: uibarbuttonsystemitem.camera, target: self, action: "takepicture")
create function
func takepicture() { imagepicker.takepicture() }
Comments
Post a Comment