Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Extension of "Hello World" Tutorial

shahab47shahab47 Posts: 6New Users
edited April 2012 in Tutorial Discussion
Hello Everybody..

I am new in C/C++/coding.

I recently ran my first app code from the Xcode tutorial about "hello world"

I tried to take it further, by adding one more text field and renaming all other fields.

What I am trying to do is:
There are two textfields (first name and last name), Label is there as before and button is there as before.

Now when I click on the button, the label should display "firstname lastname"

However I don't know how to catch text from two textfield and display it in the label field.

I can display one field. But not both.

Here is the piece of code:

==========================
- (IBAction)B_showname: (id)sender
{
self.B_result = self.TF_firstname.text;
self.LB_clickthebutton.text = self.B_result;

}
===========================

The header file is:
===========================
@interface HelloWorld_v1ViewController : UIViewController
<UITextFieldDelegate>

@property (weak, nonatomic) IBOutlet UITextField *TF_firstname;
@property (weak, nonatomic) IBOutlet UITextField *TF_lastname;
@property (weak, nonatomic) IBOutlet UILabel *LB_clickthebutton;
@property (copy, nonatomic) NSStream *B_result;

- (IBAction)B_showname: (id)sender;
============================

I would appreciate the help.

Thanks a lot in advance

Shahab
Sign In or Register to comment.