Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14404] iOS: PLAIN style button has no border margin when height/width = SIZE

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.1.1
Fix Version/sn/a
ComponentsiOS
LabelsSystemButtonStyle, button, buttons, ios, iphone, reprod, size
ReporterSteve Trautman
AssigneeUnknown
Created2013-06-26T19:40:07.000+0000
Updated2018-02-28T20:03:40.000+0000

Description

*Problem* When a button with height: Ti.UI.SIZE, width: Ti.UI.SIZE uses the default style, the auto-sized button has a margin around the text. When it use a style of PLAIN, there is no margin around the text. Both scenarios should have the same auto-size behavior. At least I hope this isn't by design, because otherwise there is effectively no useful auto-size feature with PLAIN buttons. *app.js*
var win = Ti.UI.createWindow({
	backgroundColor : '#ffffff',
	navBarHidden : true,
	exitOnClose : true
});

var stdBtnGradientNormal = {
	type : 'linear',
	startPoint : {
		x : '0%',
		y : '0%'
	},
	endPoint : {
		x : '0%',
		y : '100%'
	},
	colors : [{
		color : 'white'
	}, {
		color : 'lightgray'
	}]
};

var btnStyle = {
	focusable : true,
	color : 'black',
	borderRadius : 10,
	borderColor : 'gray',
	borderWidth : 1,
	textAlign : Ti.UI.TEXT_ALIGNMENT_CENTER,
	backgroundGradient : stdBtnGradientNormal,
	backgroundColor : 'transparent',
	title : 'Borderlands',
	top : 100,
	height : Ti.UI.SIZE,
	width : Ti.UI.SIZE,
	visible : true
};

var btnDefault = Ti.UI.createButton(btnStyle);
win.add(btnDefault);

btnStyle.style = Ti.UI.iPhone.SystemButtonStyle.PLAIN;
btnStyle.top = 200;
var btnPLAIN = Ti.UI.createButton(btnStyle);
win.add(btnPLAIN);

win.open();

Comments

  1. Daniel Sefton 2013-06-26

    Tested and confirmed on iOS 6 simulator with Ti SDK 3.1.1 GA
  2. Lee Morris 2017-06-26

    I am able to reproduce this issue with the following environment; iPhone 7 (10.2) Studio 4.9.0.201705302345 Ti SDK 6.1.1.v20170623141152 Appc NPM 4.2.9 Appc CLI 6.2.1 Ti CLI 5.0.13 Alloy 1.9.11 Arrow 2.0.0 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131

JSON Source