IOS start up project

Hello there,

I am start up with iOS develop, on the apple site, I found a working sample code, this code can close keypad by delication, but I cannot make it work when click on button.

I try to add following code in the button click event, but it is not working with error.

 [self.TextField resignFirstResponder];

Please help me understand what need to be changed and what am I doing wrong? Appreciate your time and help.

I have trying to find books of Xcode 5, but most of the books in Amazon is not released yet, can I buy a book target xcode 4 and start from there?

---------------------------------------
//
//  ViewController.h
//  HelloTest
//
//  Created by Patrick Au on 9/26/13.
//  Copyright (c) 2013 Patrick Au. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController <UITextFieldDelegate>
- (IBAction)ChangeGreetings:(id)sender;


@property (strong, nonatomic) IBOutlet UITextField *TextField;
@property (strong, nonatomic) IBOutlet UILabel *label;

@property (copy,nonatomic) NSString *UserName;

@end

---------------------------------

//
//  ViewController.m
//  HelloTest
//
//  Created by Patrick Au on 9/26/13.
//  Copyright (c) 2013 Patrick Au. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end



@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
      // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)ChangeGreetings:(id)snder {
   // [self.TextField resignFirstResponder];
    self.UserName = self.TextField.text;
   
    NSString *nameString = self.UserName;
    if ([nameString length] == 0) {
        nameString = @"World";
    }
   
    NSString *greeting = [[NSString alloc] initWithFormat:@"Hello, %@!", nameString];
    self.label.text = greeting;
}

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


@end
-----------------------------------
LVL 1
tomcattyyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

darbid73Commented:
Your question is very similar to another here in the forum.

Look at step 3 and try it.

In my opinion most book on iOS are somewhat or somehow out of date all the time because of the speed of new versions.  Books on 4 and 5 would be ok for many things and to get the basics, but anything new in 6 or 7 of course will be missing.

You should look at the changes and decide if it is worthwhile.  Because of the major changes in 5 and 6 I would suggest you look at finding a general book for 6.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tomcattyyAuthor Commented:
Thanks  darbid73,

That solve the issue, and it is a more complete way than resign FirstResponder.

After correct synthesize the parameter, [self.TextField resignFirstResponder] is also work.  I already order the updated books for continue study.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
iPhone

From novice to tech pro — start learning today.