开发者

How can I access IPhone camera to take a picture Using corona

I'm new to programming and making an app for iphone and android with Corona SDK.I want to take a picture with Iphone camera and then save it for further work . How can I access the camera of a device 开发者_如何转开发in corona . Thanks in advance .


You can use media.show() to use the camera in Corona.

Here is the API reference page: http://developer.anscamobile.com/reference/index/mediashow

And a usage example:

local onComplete = function(event)
local photo = event.target
    print( "photo w,h = " .. photo.width .. "," .. photo.height )
end

media.show( media.Camera, onComplete )


You can use this code it may useful to you,

local listener = function( event )
    if media.hasSource( media.Camera ) then
        media.show( media.Camera, sessionComplete )
    else
        native.showAlert("Corona", "Camera not found.")
    end
    return true
end

frameRect:addEventListener("tap",listener);


You can use below url for implementing Camera successfully in your Corona App - http://developer.coronalabs.com/content/camera


I've had a look at the API and it seems that you can't access the camera from Corona.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜