0
votes

I'm just learning LUA/Corona and am wondering if it is possible to have a tableView inside of a ScrollView?

I've got the below scroller to enable everything below the navbar to become scrollable.

--Setup the nav bar 

local navBar = display.newImageRect("assets/images/navbar.png", display.contentWidth + 15, 44)
navBar.x = display.contentWidth*.5
navBar.y = math.floor(display.screenOriginY + navBar.height*0.5)

local navHeader = display.newText("My Game", 0, 0, "Handlee", 36)
navHeader:setTextColor(255, 255, 255)
navHeader.x = display.contentWidth*.5
navHeader.y = navBar.y

    local scroller = widget.newScrollView
    {
        top = 44,
        width = display.contentWidth,
        height = 568,
        scrollWidth = display.contentWidth,
        scrollHeight = display.contentHeight,
        hideBackground = true,
        horizontalScrollDisabled = true,
        maskFile = "assets/images/mask-320x568.png"
    }

I'm trying to add tables to this ScrollView. Is it possible to simply use widget.newTableView? the only issue I have is that the table will be dynamic in the number of rows that it could contain. It will retrieve JSON data from a API call. So i won't be able to define the height of the table, as their could be 0 rows or 10. I would want the tableView to be static within the ScrollView.

Essentially I'm trying to re-create something like this: http://cdn.thenextweb.com/wp-content/blogs.dir/1/files/2013/01/Ruzzle.jpg (the right image - where it says waiting for opponent)

I do have a custom background image that I want to assign to each row. So i was thinking simply render an image for each row of data then render the text etc on top of each image, however i'd won't to have the onRowTouch events and i'd want to assign each row an id which i believe is only possible with TableView?

1

1 Answers

0
votes

I believe the tableView functions as a scrollview. Meaning that once your tableView exceeds the screen height, it provides the mechanism for scrolling itself. From my understanding, a tableView must exist on a scene by itself. Have not seen an example that has something along with a tableView on the same scene (storyboard).