Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9166] iOS: Button background image scaling issues when button height is smaller than its background image

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-09-28T21:40:57.000+0000
Affected Version/sRelease 2.0.1, Release 1.8.3
Fix Version/sRelease 2.1.0, Sprint 2012-11 API, Release 3.0.0, Sprint 2012-20 API, 2012 Sprint 20
ComponentsiOS
LabelsSupportTeam, api, module_button, qe-testadded, regression
ReporterVarun Joshi
AssigneeVishal Duggal
Created2012-05-17T11:45:40.000+0000
Updated2012-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

FileDateSize
button-background.png2012-05-17T11:45:40.000+00001302
Screenshot.png2012-05-17T11:45:40.000+000012705
topcap.jpg.jpg2012-08-29T07:39:00.000+000098783

Comments

  1. Blain Hamon 2012-06-01

    Pull merged
  2. Neha Chhabra 2012-06-06

    Tested with Titanium SDK: 2.1.0.v20120605190238 Tested with Titanium  Studio: 2.1.0.201206041625
  3. Neha Chhabra 2012-06-06

    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)
  4. Thomas Wilkinson 2012-08-29

    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!
  5. Thomas Wilkinson 2012-08-29

    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.
  6. Ingo Muschenetz 2012-09-28

    Thomas: please provide some test code and file a new issue, please. We'll be happy to look at it.

JSON Source