Scrollview and TextField

I’m using scrollview however my textField doesn’t go behind my header. So I tried swapping substituting the textField with a fake textField however that means (from the way I coded it) the user would have to tap the screen twice in order to be able to type in the textField. Does anyone know if there’s a better way to do this?

Here my current code:

–textField

local textField = native.newTextField(centerX,centerY, fullw, heightOfTextfield )

textField.isVisible = false

–fake textField

local fakeTextField = display.newRect(centerX, centerY,  fullw-2, heightOfTextfield-2)

fakeTextField:setFillColor(1,1,1,0.7)

local function touchingFaker(event)

if event.phase == “began” then

fakeTextField.isVisible=false

textField.isVisible=true

return true

end

end

fakeTextField:addEventListener(“touch”,touchingFaker)

local function touchAnywhere (event)

if event.phase == “began” then

fakeTextField.isVisible=true

textField.isVisible=false

end

return true

end

Runtime:addEventListener(“touch”,touchAnywhere)

If you use native.setKeyboardFocus() you wont need that fakefield, unless it for visual control.

Hope this helps  :) 

Thanks!  :lol: My app works like a charm now.

If you use native.setKeyboardFocus() you wont need that fakefield, unless it for visual control.

Hope this helps  :) 

Thanks!  :lol: My app works like a charm now.