Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 03-27-2009, 07:04 AM   #23 (permalink)
kaktusok
New Member
 
Join Date: Mar 2009
Posts: 5
kaktusok is on a distinguished road
Default

I try to repeat example into First Steps manual, but i can't understand how to hide keyboard when you press the button Done.
here is my code in "MyViewController.h"


Quote:
#import <UIKit/UIKit.h>


@interface MyViewController : UIViewController {
UITextField *textField;
UILabel *label;
NSString *string;
}

@property (nonatomic, retain) IBOutlet UITextField *textField;
@property (nonatomic, retain) IBOutlet UILabel *label;
@property (nonatomic, copy) NSString *string;
- (IBAction)changeGreeting:(id)sender;
@end
and "MyViewController.m"

Quote:
#import "MyViewController.h"

@implementation MyViewController
@synthesize textField;
@synthesize label;
@synthesize string;
- (IBAction)changeGreeting:(id)sender {
self.string = textField.text;
NSString *nameString = string;
if ([nameString length] == 0) {
nameString = @"World";
}
NSString *greeting = [[NSString alloc] initWithFormat:@"Hello, %@!",nameString];
label.text = greeting;

[greeting release];
}

-(BOOL)textFieldShouldReturn:(UITextField *)Done {
[Done resignFirstResponder];
return YES;
}
where is mistake ? keyboard doesn't hide.
kaktusok is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,632
Threads: 94,090
Posts: 402,803
Top Poster: BrianSlick (7,990)
Welcome to our newest member, buggen
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:11 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.