[TIMOB-9166] iOS: Button background image scaling issues when button height is smaller than its background image
GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-09-28T21:40:57.000+0000 |
Affected Version/s | Release 2.0.1, Release 1.8.3 |
Fix Version/s | Release 2.1.0, Sprint 2012-11 API, Release 3.0.0, Sprint 2012-20 API, 2012 Sprint 20 |
Components | iOS |
Labels | SupportTeam, api, module_button, qe-testadded, regression |
Reporter | Varun Joshi |
Assignee | Vishal Duggal |
Created | 2012-05-17T11:45:40.000+0000 |
Updated | 2012-09-28T21:40:57.000+0000 |
Description
Problem
There is a scaling issue when a button's height is set to be smaller than its background image. It appears that though the background top cap and left cap are set they are not respected when the background image is scaled. Setting the button height to be the height of the background image fixes this problem--as shown in the screenshot.
This did not happen Release 1.8.2 but occurs from the head of 1.8.x branch(1.8.3) to Release 2.0.1GA2
Sample Code
{noformat}
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
var win1 = Titanium.UI.createWindow({
title : 'Tab 1',
backgroundColor : '#fff',
layout : "vertical"
});
// button-background.png is 39x37
var button1 = Ti.UI.createButton({
top : 0,
left : 0,
height : 34,
width : 106,
backgroundImage : "button-background.png",
backgroundTopCap:15,
backgroundLeftCap:15,
backgroundRepeat : false,
color : "#000000",
font : {
"fontSize" : 14,
"fontWeight" : "bold",
"fontFamily" : "Helvetica Neue"
},
style : Titanium.UI.iPhone.SystemButtonStyle.PLAIN,
title : "106x34"
});
var button2 = Ti.UI.createButton({
top : 50,
left : 0,
height : 37,
width : 106,
backgroundImage : "button-background.png",
backgroundTopCap : 15,
backgroundLeftCap : 15,
backgroundRepeat : false,
color : "#000000",
font : {
"fontSize" : 14,
"fontWeight" : "bold",
"fontFamily" : "Helvetica Neue"
},
style : Titanium.UI.iPhone.SystemButtonStyle.PLAIN,
title : "106x37"
});
win1.add(button1);
win1.add(button2);
win1.open();
{noformat}
The background image is also attached.
Attachments
Pull merged
Tested with Titanium SDK: 2.1.0.v20120605190238 Tested with Titanium Studio: 2.1.0.201206041625
Verified on : Tested with Titanium SDK: 2.1.0.v20120605190238 Tested with Titanium Studio: 2.1.0.201206041625 Device and version: iPhone 4s(5.1)
This is also happenning with UIView, but only on the iPhone device itself, not in the iOS Simulator. I'm using Titanium SDK version 2.1.1 (07/27/12 14:01 0fd84a2) on Titanium 2.1.1.201207271312 and building with XCode 4.4.1. Attaching image !topcap.jpg.jpg!
This is also happening with UIView, these corners should be round, not oblong and the drop shadow on top should not be as wide -- so the top of the Appcelerator logo should line up with the top of the white area.
Thomas: please provide some test code and file a new issue, please. We'll be happy to look at it.