Like a private files app. Can we store images into a directory on the iPhone created by the app? [import]uid: 49300 topic_id: 16715 reply_id: 316715[/import]
Beautiful! Thank you! [import]uid: 49300 topic_id: 16715 reply_id: 62606[/import]
What about music and video? Do you think it’s possible to do the same like so? media.MusicLibrary or media.VideoLibrary? [import]uid: 49300 topic_id: 16715 reply_id: 62607[/import]
No problem. Anyway I have no idea if it will work with music or video, since I’ve never needed it. I wasn’t even aware that Corona started supporting access to music or video libraries.
[import]uid: 23649 topic_id: 16715 reply_id: 62609[/import]
I’m not 100% sure what you mean by “private files app”, but you can. Heres some sample code to store/reload one image. Saving/Loading multiple images get kind of tricky.
This will open the library:
local function newphoto ( event )
if (event.phase == "release") then
media.show( media.PhotoLibrary, sessionComplete )
return true
end
end
This will save the image:
local function sessionComplete ( event )
t = event.target
local photot = display.newGroup()
photot:insert(t)
local baseDir = system.DocumentsDirectory
display.save(photot, "photo.jpg", baseDir)
end
This will load the photo in another scene:
local baseDir = system.DocumentsDirectory
local img = display.newImage("photo.jpg",baseDir)
Edit:
I’m sorry I forgot to mention this sample implies that your are using ui.lua for the newphoto button.
[import]uid: 23649 topic_id: 16715 reply_id: 62605[/import]