Is anyone else having this problem? I’m rendering a custom segmented control using an image sheet and it is failing to render the dividers at the same height as the rest of the control.
This is how it currently looks:
As you can see, the dividers are about half the height of the control. Changing the divider values in the sheet definition or the segmented control constructor fail to have any useful effect.
Here is the image sheet: segment.png
And here is the code I’m using:
-- Listen for segmented control events local function onSegmentPress( event ) local target = event.target print( "Segment Label is:", target.segmentLabel ) print( "Segment Number is:", target.segmentNumber ) end -- Segment button labels local segments = { "Paid", "Free", "Top" } -- Image sheet options and declaration local options = { frames = { { x=0, y=0, width=40, height=58 }, { x=40, y=0, width=40, height=58 }, { x=80, y=0, width=40, height=58 }, { x=120, y=0, width=40, height=58 }, { x=160, y=0, width=40, height=58 }, { x=200, y=0, width=40, height=58 }, { x=240, y=0, width=2, height=58 } }, sheetContentWidth = 242, sheetContentHeight = 58 } local segmentSheet = graphics.newImageSheet( "segment.png", options ) -- Create a custom segmented control local segmentedControl = widget.newSegmentedControl { left = display.actualContentWidth\*.05, top = 60, sheet = segmentSheet, leftSegmentFrame = 1, middleSegmentFrame = 2, rightSegmentFrame = 3, leftSegmentSelectedFrame = 4, middleSegmentSelectedFrame = 5, rightSegmentSelectedFrame = 6, segmentFrameWidth = 40, segmentFrameHeight = 58, dividerFrame = 7, dividerFrameWidth = 2, dividerFrameHeight = 58, labelSize = 28, segmentWidth = display.actualContentWidth\*.9/#segments, segments = segments, defaultSegment = 1, labelColor = { default = { 0, .5, .98 }, over = { .97, .97, .97 }, }, onPress = onSegmentPress } parent:insert( segmentedControl )