This is driving me mad! Using the following code segment to draw a simple rectangle and then place a simple piece of text over it. Horizontal centering is working well but vertical is off. Kindly see attached image which is the result of code that follows. Can anyone kindly point out my error to me? Thanks much!!!
local widget = require( "widget" ) local titleBarHeight = 90 local splitLeftWidth = 400 local titleBarStrokeWidth = 2 local titleBarFillColor = {247/255, 247/255, 247/255} local titleBarStrokeColor = {192/255, 192/255, 196/255} local titleBarLeftLabel = "Settings" local titleBarLeft = display.newRect(0, 0, splitLeftWidth, titleBarHeight) titleBarLeft.anchorX, titleBarLeft.anchorY = 0, 0 titleBarLeft.strokeWidth = titleBarStrokeWidth titleBarLeft:setFillColor(unpack(titleBarFillColor)) titleBarLeft:setStrokeColor(unpack(titleBarStrokeColor)) local titleBarLeftText = display.newText( titleBarLeftLabel, 0, 0, native.systemFont, 20 ) titleBarLeftText:setFillColor( 0, 0, 0 ) titleBarLeftText.anchorX = 0.5 titleBarLeftText.anchorY = 0.5 titleBarLeftText.x = splitLeftWidth / 2 titleBarLeftText.y = titleBarHeight / 2