I’ve populated a table with a list of Last names, to display within the newTableView{}
Things are going fine, but I’m looking to enhance the visual aspect a little.
The best I can describe is with this link to an image I found:
http://cdn3.digitaltrends.com/wp-content/uploads/2011/11/Movies-by-Flixster-iphone-app.jpg
The right half of the image shows:
-Download
-My Rating
-No Photos Available
The top and bottom are rounded, but the middle list item is not.
Most lists I populate into the widget.newTableView{} I’m fine without the rounded corners, but there are some lists that are only a dozen lines long, and I’d like to pretty it up with rounded top and rounded bottom.
So, any help in this area would be appreciated.
Below is my Last names list, in case there’s a way to actually work the rounding corners within the widget method.
\_W = display.contentWidth; -- typically: 320
\_H = display.contentHeight; -- typically: 480
\_TOP = display.statusBarHeight; -- typically: 20
local widget = require("widget")
local listRecs = {}
local nameData ={"Smith","Baxter","johnson","Williams","Jones","Brown","Davis","Miller","Brown","Davis","Miller"}
local list = nil
--prepare the list
local function setUp()
local bg = display.newRect(0, 0, \_W, \_H)
bg:setFillColor(0, 155, 73)
list = widget.newTableView{
--top = \_TOP ,
--height = 504,
topPadding = 10,
bottomPadding = 10,
renderThresh = 150
}
end
local function loadData()
for x = 1, #nameData do
listRecs[x] = {}
listRecs[x].name = nameData[x]
listRecs[x].age = math.random(18,35)
listRecs[x].showDel = false
listRecs[x].color = 0
end
end
local function showRecords()
local function onRowRender( event )
local row = event.row
local rowGroup = event.view
local idx = row.index or 0
local color = 0
---------create textobject, property of row
row.textObj = display.newRetinaText( listRecs[idx].name, 0, 0,"helvetica", 16)
row.textObj:setTextColor(color)
row.textObj:setReferencePoint( display.CenterLeftReferencePoint )
row.textObj.x = 20
row.textObj.y = rowGroup.contentHeight \* 0.35
row.textObj2 = display.newRetinaText( "age: " ..tostring(listRecs[idx].age), 0, 0, "helvetica", 14)
row.textObj2:setTextColor(color)
row.textObj2:setReferencePoint( display.CenterLeftReferencePoint )
row.textObj2.x = 20
row.textObj2.y = rowGroup.contentHeight \* 0.65
rowGroup:insert(row.textObj)
rowGroup:insert(row.textObj2)
end --onRowRender
for x = 1, #listRecs do
list:insertRow {
height = 50,
onRender = onRowRender
}
end
end --showRecords
setUp()
loadData()
showRecords()
[import]uid: 154122 topic_id: 31192 reply_id: 331192[/import]