Multiple titles on UIButton

Discussion in 'iOS Development' started by johnmabassa, Aug 6, 2009.

  1. johnmabassa

    johnmabassa Member

    Joined:
    Mar 16, 2009
    Messages:
    87
    Likes Received:
    0
    Hi,

    I have a button with title Name. On clicking it,a new view shows where user can enter the name. Once he come back to first page I need show the title like this

    Before entering name button look like this
    ---------
    | Name: |
    | |
    ---------

    After entering the name I want it to be like this
    ---------
    | Name: |
    | John |
    ---------

    I tried using linebreakmode for the label and it works but since it is a single label I need to add a lot of spaces in between so that the name will come on the next line. It may not work fine for all conditions.
    Any idea how to add two lables to the button's title?

    -john
  2. Pelaez-1

    Pelaez-1 New Member

    Joined:
    May 5, 2008
    Messages:
    822
    Likes Received:
    0
    Device:
    iPhone
    The UIButton is a subclass of the UIView, so you can add subviews to it with [button addSubview:label];

Share This Page