Mysterious sizing of button in iOS7 skin?

59 views
Skip to first unread message

timo.v...@gmail.com

unread,
Feb 19, 2014, 5:21:44 AM2/19/14
to codenameone...@googlegroups.com
I have changed the standard "Button" style to include a 2mm top and bottom padding for all states.
This works on all device types in the emulator, but in iOS7 emulators the vertical size is often (but not always) reduced in the "pressed" state.

Is this a bug or could it be some setting I missed?

See https://www.youtube.com/watch?v=CDUmet7jsfY for a video of the problem.

Shai Almog

unread,
Feb 19, 2014, 12:48:05 PM2/19/14
to codenameone...@googlegroups.com, timo.v...@gmail.com
Did you set the same padding with the right selection for millimeter in pressed/selected states?
How did you implement the border, if the border determines the size it might shrink if cut differently for different states.

timo.v...@gmail.com

unread,
Feb 19, 2014, 1:34:50 PM2/19/14
to codenameone...@googlegroups.com, timo.v...@gmail.com


On Wednesday, February 19, 2014 6:48:05 PM UTC+1, Shai Almog wrote:
Did you set the same padding with the right selection for millimeter in pressed/selected states?
How did you implement the border, if the border determines the size it might shrink if cut differently for different states.

 I have checked the button styles, and they are identical:

Button unselected:
  • Padding: 1mm, 1mm, 2 mm, 2 mm
  • Margin: 1mm, 1mm, 1mm, 1mm
  • Border: Line, Thickness 1

Button selected:
  • Derive: Button unselected

Button pressed:
  • Padding: 1mm ,1mm, 2mm, 2mm
  • Margin: 1mm, 1mm, 1mm, 1mm
  • Border: Line, Thickness 1

What surprises me is that I observe this effect only in the iOS7 emulator, and not in any other iOS or Android emulator.
As you can see in the video, the sizing problem is not consistent: Sometimes the button shinks, but frequently it behaves just as expected.

How can this be non-deterministic?

PS: It is also not dependent on the screen resolution, as the effect appears both in the iPhone3gs_os7 and iPhone5_os7 skins.

Shai Almog

unread,
Feb 20, 2014, 2:37:44 AM2/20/14
to codenameone...@googlegroups.com, timo.v...@gmail.com
The problem is in the selected state.
Derive for our styles is problematic since it can trigger cyclic inheritance which is painful to deal with. The best approach would be to use a UIID like MyButton or not rely on derive working.

timo.v...@gmail.com

unread,
Feb 20, 2014, 3:27:17 AM2/20/14
to codenameone...@googlegroups.com, timo.v...@gmail.com
Hi Shai,

On Thursday, February 20, 2014 8:37:44 AM UTC+1, Shai Almog wrote:
The problem is in the selected state.
Derive for our styles is problematic since it can trigger cyclic inheritance which is painful to deal with. The best approach would be to use a UIID like MyButton or not rely on derive working.

Thank you for this hint. Although I don't understand how "derive" creates cyclic dependencies for built-in styles and not for custom styles, removing the derive for the selected state did solve the problem.

Please add some instructions about the "derive" limitations of built-in styles in the manual, so other users don't fall in this same trap. (Or better still, resolve the design issue that is causing this problem in the first place.)

Shai Almog

unread,
Feb 20, 2014, 12:51:03 PM2/20/14
to codenameone...@googlegroups.com, timo.v...@gmail.com
I'll add a note about it to the derive UI in the designer.
Reply all
Reply to author
Forward
0 new messages