Add label to the view with code?

Discussion in 'iOS Programming' started by oxcug, Apr 13, 2012.

  1. oxcug, Apr 13, 2012
    Last edited: Apr 13, 2012

    oxcug macrumors newbie

    Joined:
    Oct 3, 2011
    #1
    Hey guys how do I add a label to a UIView (separate from the view controller)? And how would I do it for a UIScrollView? Of course this is all via code.
     
  2. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #2
    Code:
    UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(1,1,40,40)];
    label1.text =@"BAWSE";
    [self.scrollview addSubview:label1];
    
    Something like that, did it out of the head.
    It's not that hard..
     
  3. oxcug thread starter macrumors newbie

    Joined:
    Oct 3, 2011
    #3
    Yeah that's what I ended up doing Thanks very much!
     

Share This Page