Resize event problem

I see a reference to a gyroscope change in 2538.  Can you try that build or one later and see if you still have the issue?  I don’t see any other things that might affect it, though the 64 bit version (2540) contained a lot changes too.

If you can narrow it down to a build and produce a simple app that shows that the events are not firing, that would help a lot.

Rob

Can you throw together a sample app for us to look at?

Rob

Between Build: 2015.2535 and Build: 2015.2537, I made an error earlier and forgot that I changed my code to use “orientation” event and not “resize”. 

local widget = require("widget") display.setStatusBar( display.HiddenStatusBar ) --image sheet options and declaration menuBtns = { "CAMPAIGN", "MULT-PLAYER", "BUILDER", "HELP" } local myRoundedRect = display.newRoundedRect( display.contentCenterX, display.contentCenterY, display.contentWidth\*.5, display.contentHeight\*.5, 12 ) myRoundedRect.strokeWidth = 3 myRoundedRect:setFillColor( 0.2 ) myRoundedRect:setStrokeColor( .4 ) local function onRowTouch( event ) end -- The "onRowRender" function may go here (see example under "Inserting Rows", above) local function onRowRender( event ) -- Get reference to the row group local row = event.row -- Cache the row "contentWidth" and "contentHeight" because the row bounds can change as children objects are added local rowHeight = row.contentHeight local rowWidth = row.contentWidth local rowTitle = display.newText( row, menuBtns[row.index], 0, 0, nil, 34 ) rowTitle:setFillColor( 0 ) -- Align the label left and vertically centered rowTitle.anchorX = 0 rowTitle.x = rowWidth \* 0.5 - rowTitle.width/2 rowTitle.y = rowHeight \* 0.5 end -- Create the widget local tableView = widget.newTableView { left = display.contentCenterX, top = display.contentCenterY, height = 400, width = display.contentWidth\*.8, hideBackground = true, isLocked = true, noLines = true, onRowRender = onRowRender, --onRowTouch = onRowTouch, --listener = scrollListener } -- Insert 40 rows for i = 1, 4 do local rowHeight = 100 local rowColor = { default={ 1, 1, 1 }, over={ 0, 0.6, 0.6 } } -- Insert a row into the tableView tableView:insertRow { rowHeight = rowHeight, rowColor = rowColor } end local topLeft = display.newRoundedRect( 0, 0, display.contentWidth\*.35, display.contentHeight , 12 ) topLeft.strokeWidth = 3 topLeft:setFillColor( 0,1,0 ) topLeft:setStrokeColor( 0, 1, 0 ) topLeft.anchorX = .5 local botRight = display.newRoundedRect( 0, 0, display.contentWidth\*.35, display.contentHeight, 12 ) botRight.strokeWidth = 3 botRight:setFillColor( 0,0,1 ) botRight:setStrokeColor( 0, 0, 1 ) botRight.anchorX = .5 -- local btn = display.newImageRect( "btn.png", 200, 200 ) -- btn.x = display.contentCenterX -- btn.y = display.contentCenterY function makeUI() cw = display.contentWidth ch = display.contentHeight if(system.orientation=="landscapeLeft" or system.orientation == "landscapeRight")then h = 1 topLeft.width = cw\*.15 botRight.width = cw\*.15 topLeft.height = ch botRight.height = ch tlx = topLeft.width/2 tly = ch/2 brx = cw - botRight.width/2 bry = ch/2 topLeft.x = tlx topLeft.y = tly botRight.x = brx botRight.y = bry elseif(system.orientation == "portrait" or system.orientation == "portraitUpsideDown")then topLeft.height = ch\*.15 botRight.height = ch\*.15 topLeft.width = cw botRight.width = cw tlx = cw/2 tly = topLeft.height/2 brx = cw/2 bry = ch - botRight.height/2 h = .65 topLeft.x = tlx topLeft.y = tly botRight.x = brx botRight.y = bry end myRoundedRect.x = cw\*.5 myRoundedRect.y = ch\*.5 myRoundedRect.width = cw\*.65 myRoundedRect.height = ch\*h tableView.width = cw\*.62 tableView.x = display.contentCenterX tableView.y = display.contentCenterY end makeUI() local function onResize( event ) makeUI() end -- Add the "resize" event listener Runtime:addEventListener( "resize", onResize )

Resize works on ios device before build 2537.

Can I go ahead and get you to file a bug report.  You will need to provide a complete sample app but we don’t want your whole app.  Build a minimal example app, complete with build.settings and config.lua and all needed assets to run the app and compress it into a .zip file  and use the “Report a Bug” link at the top of the page.

The zip file needs to be such that we unzip it and run it and see the problem. 

Thanks

Rob

Hi Rob:

I also can confirm that this is happening for me, and I whipped up a simple sample app that illustrates the problem (it works fine in the simulator, but not if you build and run on an iOS device). I also filed a bug report. That bug report’s case # is  39317.

Hopefully this can get corrected in a daily build ASAP. I’m assuming that it’s a relatively easy fix - it would appear that the Runtime object is just not dispatching “resize” events on iOS devices.

Thanks,

Jason

PS: below is the code to my sample main.lua (but to really see it you should download the attached ZIP file, as it contains config.lua & build.settings that you’ll need to build for device so you can witness the bug on-device)

-- RESIZE BUG (TESTED IN CORONA SDK 2015.2570 display.setStatusBar( display.HiddenStatusBar ) ------------------------------------------------------------------------------------ -- DELARE GLOBAL SCREEN POSITION VARIABLES ------------------------------------------------------------------------------------ centerX = display.contentCenterX centerY = display.contentCenterY screenTop = math.floor(display.screenOriginY) screenLeft = math.floor(display.screenOriginX) screenBottom = display.contentHeight - screenTop screenRight = display.contentWidth - screenLeft screenWidth = screenRight - screenLeft screenHeight = screenBottom - screenTop ------------------------------------------------------------------------------------ -- PLACE RECTS IN CORNERS ------------------------------------------------------------------------------------ local topLeft = display.newRect(screenLeft, screenTop, 40, 40) topLeft:setFillColor(1, 0, 0) topLeft.anchorX, topLeft.anchorY = 0, 0 local topRight = display.newRect(screenRight, screenTop, 40, 40) topRight:setFillColor(0, 1, 0) topRight.anchorX, topRight.anchorY = 1, 0 local bottomLeft = display.newRect(screenLeft, screenBottom, 40, 40) bottomLeft:setFillColor(0, 0, 1) bottomLeft.anchorX, bottomLeft.anchorY = 0, 1 local bottomRight = display.newRect(screenRight, screenBottom, 40, 40) bottomRight:setFillColor(1) bottomRight.anchorX, bottomRight.anchorY = 1, 1 ------------------------------------------------------------------------------------ -- REPOSITION OBJECTS ON RESIZE (works in Simulator, not on iOS Device) ------------------------------------------------------------------------------------ function onResize( event ) print("RESIZE EVENT FIRED!") -- this won't print out to device terminal (event not fired) centerX = display.contentCenterX centerY = display.contentCenterY screenTop = math.floor(display.screenOriginY) screenLeft = math.floor(display.screenOriginX) screenBottom = display.contentHeight - screenTop screenRight = display.contentWidth - screenLeft screenWidth = screenRight - screenLeft screenHeight = screenBottom - screenTop topLeft.x, topLeft.y = screenLeft, screenTop topRight.x, topRight.y = screenRight, screenTop bottomLeft.x, bottomLeft.y = screenLeft, screenBottom bottomRight.x, bottomRight.y = screenRight, screenBottom end Runtime:addEventListener( "resize", onResize )

Well, at least I’m not the only one with this problem. :slight_smile:

I’m needing this bug fixed ASAP. I have many customers complaining about this issue.

I tried the simplest code for testing this:

Runtime:addEventListener("resize", function(e) print("RESIZED/ORIENTATION CHANGED") end)

For a quick fix you can change resize to orientation event.

I used orientation event before but i had to move to resize event. Unfortunately, I don’t remember exactly, but I found some issues with the orientation event.