Multiple multiline labels

Discussion in 'iOS Programming' started by arnieterm, Apr 13, 2009.

  1. arnieterm macrumors regular

    Aug 28, 2008
    Hi all
    I am working on an iphone application that displays a table view [Navigation based]. When user selects a row then the app switches to details view that has four labels with different fonts and sizes placed one above the other in the view. All these labels are multiline. My problem is that when one label has more than two lines of text, it partially overlapps over the next label below it. How can we render all these labels so that if they are multiline all appears properly and with the desired font and size.
    In simple words I want to say that If any label has more than one line of text then the next label below it should move by that amount of space so that both will appear with their full text display with no truncation

    With Regards
    Parvez Qureshi
  2. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    You'll have to write some code that adjusts the frames of the labels based on their contents and that of the labels above them. The autoResizingMask can be used to adjust the sizes of views but it works based on the superview, not peer views.

    You probably want to put all your labels in another view and implement layoutSubviews in the container.

Share This Page