My text is showing up in different sizes. On most devices it fits perfectly. On some (this screen is from the iPhone 4s) it seems a little large. What do I do?
anyone have a quick fix for this? help!
here is an image:
http://www.questlord.com/screenshots/TextTooBig.jpg
local ui = require("ui")
-------------------------------------------
-- General event handler for fields
-------------------------------------------
-- You could also assign different handlers for each textfield
local defaultField
local fields = display.newGroup()
local function fieldHandler( event )
if ( "began" == event.phase ) then
-- This is the "keyboard has appeared" event
-- In some cases you may want to adjust the interface when the keyboard appears.
elseif ( "ended" == event.phase ) then
-- This event is called when the user stops editing a field: for example, when they touch a different field
elseif ( "submitted" == event.phase ) then
-- This event occurs when the user presses the "return" key (if available) on the onscreen keyboard
-- Hide keyboard
playerName = defaultField.text
fields:removeSelf()
verifyName()
end
end
-- Predefine local objects for use later
-------------------------------------------
-- \*\*\* Buttons Presses \*\*\*
-------------------------------------------
-- Default Button Pressed
--defaultField:removeSelf()
-- fields:remove( defaultField )
-- Number Button Pressed
------------------------------------------
-- \*\*\* Create native input textfields \*\*\*
-------------------------------------------
-- Note: currently this feature works in device builds or Xcode simulator builds only
-- Note: currently this feature works in device builds only
local isAndroid = "Android" == system.getInfo("platformName")
local inputFontSize = 18
local inputFontHeight = 30
if isAndroid then
-- Android text fields have more chrome. It's either make them bigger, or make the font smaller.
-- We'll do both
inputFontSize = 14
inputFontHeight = 42
end
defaultField = native.newTextField( 10, 120, 300, 30, fieldHandler )
-- o:addEventListener( 'userInput', listener )
-- WARNING: The 'listener' argument to native.newTextField( left, top, width, height [, listener] ) is deprecated. Call the object method o:addEventListener( 'userInput', listener ) instead.
defaultField.font = native.newFont( "Quadrat Serial", inputFontSize / display.contentScaleX )
defaultField.align = "center"
-- Add fields to our new group
fields:insert(defaultField)
native.setKeyboardFocus( defaultField )
local bkgd = display.newRect( 0, 0, display.contentWidth, display.contentHeight )
bkgd:setFillColor( 0, 0, 0, 0 ) -- set Alpha = 0 so it doesn't cover up our buttons/fields
end
Does this have to do with the issue of text not aligning right on -some ios- devices when not using exact coords? [import]uid: 100299 topic_id: 35169 reply_id: 335169[/import]