How to call multiple user variables - iPhone app
First off, I'm a noob at iPhone application development, so forgive me if I don't get it right away.

I have a simple question concerning how to call multiple variables in a sentence-style text with other words in between the variables.

I'm teaching myself iPhone application development, so I'm basing this code off the instructions by Apple entitled "Your First iOS App" and tweaking the code to learn it better.

The basic layout of the app is two text fields labeled "Name" and "Occupation". Below that is a text area (label) and a button for submitting the text field information. Once the user inputs and submits their Name and Occupation, the application should place those variables into the sentence: "Hello, my name is [Name], and I'm a [Occupation]." and display the sentence in the text area (label).

This is what I have so far:

    - (IBAction)changeGreeting:(id)sender {
    
    self.userName = self.textField.text;
    
    NSString *nameString = self.userName;
    if ([nameString length] == 0) {
        nameString = @"Name";
    }
        NSString *greeting = [[NSString alloc] initWithFormat:@"Hello, my name is %@,", nameString];
    self.label.text = greeting;
    
    self.userOccupation = self.textField.text;
    
    NSString *occupationString = self.userOccupation;
    if ([occupationString length] == 0) {
        occupationString = @"Occupation";
    }
    NSString *description = [[NSString alloc] initWithFormat:@" and I'm a %@.", occupationString];
    self.label.text = description;
    }

    - (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
    if (theTextField == self.textField) {
        [theTextField resignFirstResponder];
    }
    return YES;
    }
    @end


When running the app and submitting the name "John" and the occupation "developer", the output sentence does not include the "Hello, my name is John," output, only the "and I'm a developer."

How do I get and call the variables in such a way that each variable is displayed in its desired place in the sentence so that it reads "Hello, my name is John, and I'm a developer." in one interrupted sentence?
How to call multiple user variables - iPhone app
===

First off, I'm a noob at iPhone application development, so forgive me if I don't get it right away.

I have a simple question concerning how to call multiple variables in a sentence-style text with other words in between the variables.

I'm teaching myself iPhone application development, so I'm basing this code off the instructions by Apple entitled "Your First iOS App" and tweaking the code to learn it better.

The basic layout of the app is two text fields labeled "Name" and "Occupation". Below that is a text area (label) and a button for submitting the text field information. Once the user inputs and submits their Name and Occupation, the application should place those variables into the sentence: "Hello, my name is [Name], and I'm a [Occupation]." and display the sentence in the text area (label).

This is what I have so far:

    - (IBAction)changeGreeting:(id)sender {
    
    self.userName = self.textField.text;
    
    NSString *nameString = self.userName;
    if ([nameString length] == 0) {
        nameString = @"Name";
    }
        NSString *greeting = [[NSString alloc] initWithFormat:@"Hello, my name is %@,", nameString];
    self.label.text = greeting;
    
    self.userOccupation = self.textField.text;
    
    NSString *occupationString = self.userOccupation;
    if ([occupationString length] == 0) {
        occupationString = @"Occupation";
    }
    NSString *description = [[NSString alloc] initWithFormat:@" and I'm a %@.", occupationString];
    self.label.text = description;
    }

    - (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
    if (theTextField == self.textField) {
        [theTextField resignFirstResponder];
    }
    return YES;
    }
    @end


When running the app and submitting the name "John" and the occupation "developer", the output sentence does not include the "Hello, my name is John," output, only the "and I'm a developer."

How do I get and call the variables in such a way that each variable is displayed in its desired place in the sentence so that it reads "Hello, my name is John, and I'm a developer." in one interrupted sentence?