[TIMOB-23189] iOS: Cannot change the width and height of Titanium.UI.Switch
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2016-08-28T23:06:21.000+0000 |
Affected Version/s | Release 5.3.0, Release 5.2.2 |
Fix Version/s | n/a |
Components | iOS |
Labels | qe-5.3.0 |
Reporter | Wilson Luu |
Assignee | Eric Merriman |
Created | 2016-04-11T20:53:23.000+0000 |
Updated | 2017-03-24T18:01:52.000+0000 |
Description
*Details:* On iOS, you cannot change the height or width (dp, percents, or absolute values) of Titanium.UI.Switch.
*This is not reproducible on Android i.e. you can change the height and width.*
*Steps to reproduce:*
In
In
Create a default Alloy app
In index.xml
, add the following code:
<Alloy>
<Window class="container">
<Label id="label" onClick="doClick">Hello, World</Label>
<Switch id="Switch_1"/>
</Window>
</Alloy>
In index.tss
, add the following code:
".container": {
backgroundColor:"white"
}
"Label": {
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
color: "#000"
}
"#label": {
font: {
fontSize: 12
}
}
// change the height and width to use absolute values, dp, or other percentages
"#Switch_1": {
"backgroundColor": "#000000",
"height": "19.28%",
"width": "30.80%",
"left": "39.60%",
"top": "60.80%"
}
Install app to device
*Actual:* The switch control is not resized; see attachments. *Expected:* The switch control should be resized.Attachments
File | Date | Size |
---|---|---|
android.png | 2016-04-11T20:52:39.000+0000 | 69636 |
ios.png | 2016-04-11T20:52:39.000+0000 | 23003 |
Hey [~wluu], so you expect the "wrapping view" of the switch to resized, am I correct?
[~hansknoechel], Yes.
The UISwitch is not designed to be customized , you cannot re-size it without transforming it, which isn't actual resizing but just stretching the object. From what i can see on the pictures its neither re-sizble on android just the View which holds the switch is being re-sized. On iOS since the switch is a very simple widget we don't give it a wrapper view , we directly add it to the parent.
As Angel stated above, the switch is not supposed to be resizable. And since we add it directly to prevent another wrapper-view, this should be the way to go. If we still want to resize the wrapper that can be achieved by wrapping it and size that view. Please consider to resolve, thanks!
Closing ticket as invalid with reference to the above comments.