Build error.

Discussion in 'iOS Development' started by Your Everyday Hacker, Oct 4, 2008.

  1. Your Everyday Hacker

    Your Everyday Hacker Banned

    Joined:
    Aug 12, 2008
    Messages:
    645
    Likes Received:
    0
    Code:
    -(IBAction)clicked{
    	[myLabel settext:0"Hello World!"];
    }
    "syntax error before string constant".
    Help? Only error I'm getting...
  2. gojohnnyboi

    gojohnnyboi Well-Known Member

    Joined:
    Jan 25, 2008
    Messages:
    3,339
    Likes Received:
    55

    Yeah, you have a zero there out of nowhere. NSString's start with the @ symbol. also, i just take advantage of your dot syntax here to avoid typing all those brackets. UILabel has a nonatomic property named "text" :

  3. Your Everyday Hacker

    Your Everyday Hacker Banned

    Joined:
    Aug 12, 2008
    Messages:
    645
    Likes Received:
    0
    I knew it wasn't a zero.
    D:
    Thanks.
  4. darc10222

    darc10222 Banned

    Joined:
    Dec 24, 2007
    Messages:
    749
    Likes Received:
    0
    Shouldnt it be:
    Code:
    -(IBAction)clicked:(id)sender{
    myLabel.text = @"Hello World!":
    }
    

Share This Page