I have a strange problem. When I use the widget.newSwitch inside a widget.newScrollView
the switch move in the x-axis dependent on the switch state.
Two switches with the same x-coordinates but different initialSwitchState (false,
true) will have different x-positions in the scroll view. Strange??
Am I doing something wrong, or is this a bug?
I filed a bug report some days ago, but haven’t heard back from Corona yet.
Do you get
the same result? See my attached code example.
The problem is most noticeable when you set the widget theme to “widget_theme_ios" –
on the PC simulator it will show the iOS 6 styled switch.
But even if you use the iOS7 styled switch (just remove the setTheme line), the switches
will move a bit.
I’m using the latest public build with graphics 2.0, but I think the problem was there in
Graphics 1.0 too.
local widget = require( "widget" ) widget.setTheme("widget\_theme\_ios") local \_w2 = display.contentWidth / 2 local \_h2 = display.contentHeight / 2 local \_w = display.contentWidth local \_h = display.contentHeight local scrollView = widget.newScrollView{ x = \_w2, y = \_h2, width = \_w, height = \_h+100, backgroundColor = { 1 }, hideBackground = false, scrollBarColor = { 0 } } scrollView.isHitTestMasked = true local mySwitch1 = widget.newSwitch { x = 50, y = 150, id = "mySwitch1", initialSwitchState = false, onPress = onButtonEvent } scrollView:insert( mySwitch1 ) local mySwitch2 = widget.newSwitch { x = 50, y = 250, id = "mySwitch2", initialSwitchState = true, onPress = onButtonEvent } scrollView:insert( mySwitch2 )