Hi,
After I go back to list_categories.lua scene from add_or_edit_category.lua scene native.newTextField
remains on scene with list of categories. What is proper way remove/hide text field object from scene?
I use back button to go back to previous scene.
-- add_or_update_category.lua
local slm = require 'lib.slm'
local tb = require 'lib.touch_buttons'
local history = require 'lib.history'
local sqlite3 = require 'sqlite3'
local composer = require 'composer'
local scene = composer.newScene()
local current_scene_name = composer.getSceneName( 'current' )
local previous_scene_name = 'scenes.list_of_categories'
history.addScene( current_scene_name, previous_scene_name )
function scene:create( event )
local sceneGroup = self.view
local params = event.params or {}
local category_name_for_edit = params.category_name or ''
local text_input_category_name = native.newTextField( 0, 0, 500, 100 )
text_input_category_name.text = category_name_for_edit
sceneGroup:insert( text_input_category_name )
end
function scene:show( event )
local sceneGroup = self.view
local phase = event.phase
if ( phase == "will" ) then
elseif ( phase == "did" ) then
end
end
function scene:hide( event )
local sceneGroup = self.view
local phase = event.phase
if ( phase == "will" ) then
elseif ( phase == "did" ) then
end
end
function scene:destroy( event )
end
scene:addEventListener( "create", scene )
scene:addEventListener( "show", scene )
scene:addEventListener( "hide", scene )
scene:addEventListener( "destroy", scene )
return scene
Have a nice day:)
ldurniat