Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2497] Adding Label on Button, Label is not displayed ( v1.5.0 githash: b7b9e785)

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionDuplicate
Resolution Date2011-04-15T03:21:21.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsbutton, ios, ipad, labels
ReporterAntonio Carlos Silveira
AssigneeReggie Seagraves
Created2011-04-15T03:21:20.000+0000
Updated2017-03-09T21:32:12.000+0000

Description

I am trying to use the nightly build version 1.5 (b7b9e785), because I need to i18n features, but there are several strange behaviors that didn't happen before on 1.4 and older versions of 1.5. Most of the bugs I found are related to opacity and zIndex.

Problem: Adding a Label in a Button, the Label does not appear in the screen, even when setting high zIndex values. here is the piece of code with problem.

Code:

var btn_Username = Ti.UI.createButton({
    backgroundImage:    'images/btn_username.png',
    backgroundSelectedImage: 'images/btn_username_selected.png',
    height:             49,
    width:              243,
    left:               207,
    top:                0,
    opacity:            1,
    zIndex:             1,
    style: Titanium.UI.iPhone.SystemButtonStyle.PLAIN
});
view.add(btn_Username);

var titleLabel = Ti.UI.createLabel({
    color:      '#ffffff',
    text:       Ti.App.myMemeInfo.title,
    font:       {fontSize:14, fontFamily:'Helvetica Neue', fontWeight:'bold'},
    textAlign:  'left',     
    top:        14,
    left:       12,
    height:     20,
    width:      200,
    opacity:    1,
    zIndex:     99  
});
btn_Username.add(titleLabel);

When I add the "title" attribute in the Button it works, but I can't control the width of this text separately from the width of the Button, so this attribute does not work for me.

Platform versions: iOS SDK Version: 4.2
Titanium Developer: 1.2.1

The source code of my App is available on GihHub:
http://github.com/acarlos1000/MemeiPad/">http://github.com/acarlos1000/MemeiPad/

Comments

  1. hal 2011-04-15

    Antonio

    A control, such as a button, cannot have children. Instead, add both to a view, and position the label so that it appears over the button, or simply use the button's title property.

    My preference would be to use the button's title.

    If there are issues with the button title and i18n in 1.5, then I'd recommend that you raise them in the Q&A, to confer with the community and confirm that it really is a bug.

  2. hal 2011-04-15

    Blain, I propose this ticket be marked invalid.

  3. Antonio Carlos Silveira 2011-04-15

    OK, I will change my code and use Views instead of Buttons

  4. Stephen Tramer 2011-04-15

    Duplicate was #2517

  5. Lee Morris 2017-03-09

    Closing ticket as duplicate.

JSON Source