views:

36

answers:

2
  • (IBAction) changeProductText:(NSString *)str;{ lblProductTxt.text = str; }

I have that and i am trying to make it so that i can have the str and @"text" but i don't know how to bind them together.

Any thoughts?

A: 

Are you trying to append two strings? Use stringByAppendingString::

- (IBAction) changeProductText:(NSString *)str
{
    // set label text to str followed by "text"
    lblProductTxt.text = [str stringByAppendingString:@"text"];
}
Adam Rosenfield
that didnt work
What are you trying to do exactly? Please give an example.
Adam Rosenfield
+1  A: 

I don't know if this is your issue, but the code you posted had an extra semi-colon. You have:

-(IBAction)changeProductText:(NSString *)str; //Problem is here
{
    lblProductTxt.text = str;
}

It should be

-(IBAction)changeProductText:(NSString *)str
{
    lblProductTxt.text = str;
}

You should try using the following code in your IBAction to know if str actually has a value:

NSLog(@"Value of String: %@", str)
Reed Olsen