Hi, wanna ask how to edit the rowTitle.text which generated by “widget.newTableView”?
--create answer list local function onRowRender( event ) local row = event.row local phase = event.phase local rowTitle = display.newText( row, choices[row.index], 0, 0, font, questionFontSize ) rowTitle.x = startText\_X rowTitle.y = row.contentHeight \* 0.4 rowTitle:setFillColor( fontColor ) end local function onRowTouch( event ) local row = event.target local phase = event.phase local myAnswer if "press" == phase then print( "My answer: " .. choices[row.index] ) end if "release" == phase then checkAnswer( CorrectChoice , choices[row.index]) end transition.to( QuestionBoard, { x = - \_W, time = 400, transition = easing.outExpo } ) transition.to( AnswerBoard, { x = - \_W, time = 400, transition = easing.outExpo } ) end local answerList = widget.newTableView { top = question.y + question.contentHeight \* 0.5 + 8, left = 0, width = 320, height = 200, maskFile = "mask-320x200.png", onRowRender = onRowRender, onRowTouch = onRowTouch, backgroundColor = {241/255,235/255,194/255}, } QuestionBoard:insert( answerList ) for i = 1, 5 do answerList:insertRow{ rowHeight = 40, rowColor = { default = { 241/255,235/255,194/255 }, over={ 255/255, 128/255, 0/255, 255/255 } }, } end
What I wanna to do:
- Edit the specific row.rowTitle.text which generated.
Problem faced:
- I can recreate the list for every new question every time the “Next question” button was pressed but it will took lot of the memories plus lag to the application.
- instead of making a new list every time, I prefer edit to the list.
I put an image in the attached file for you guys to see what’s my problem.
Help me please. Your help is greatly appreciated. Thank you.