Button labels are unclickable?
I have a button, with a label. If you click on the non-label part, the button will work just fine. If you click on the label (text), then it wont register a click, or show the selected state.
Would anyone have any ideas on how to resolve this? :)
Thanks a mill!
// CREATE LABEL
var buttonLabel = Ti.UI.createLabel({
text: 'Find Out More', color: '#4e3216',
shadowColor:'#FFFFE6', shadowOffset:{x:0,y:1},
textAlign:'center', top:8,
width: 'auto', height:'auto',
font:{fontWeight:'bold',fontSize:17}
});
// CREATE BUTTON
var moreBtn = Titanium.UI.createButton({
height:40, width:270, bottom:25,
style:Titanium.UI.iPhone.SystemButtonStyle.PLAIN,
borderColor:'#b89f73', borderRadius:10, borderWidth:1,
backgroundImage:'../images/ui/button-bg.png',
backgroundSelectedImage:'../images/ui/button-bg-selected.png'
});
// ASSIGN LABEL TO BUTTON
moreBtn.add(buttonLabel);
// ASSIGN CLICK EVENT TO BUTTON
moreBtn.addEventListener('click', function(){
Ti.Platform.openURL('http://www.google.com');
});
1 Answer
-
Glen
Try setting the label's touchEnabled property to false