Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // controller.m
- @implementation HelloAgainViewController
- -(IBAction) sayHello{
- NSString * out = [NSString stringWithFormat:@"Hello,%@",[txtName text]]; // settext to var
- [label setText:out]; // SET STRIMG TO LABEL FORM NSSTRING
- [txtName resignFirstResponder];// hide keybord
- }
- - (void)dealloc
- {
- [super dealloc];
- }
- - (void)didReceiveMemoryWarning
- {
- // Releases the view if it doesn't have a superview.
- [super didReceiveMemoryWarning];
- // Release any cached data, images, etc that aren't in use.
- }
- #pragma mark - View lifecycle
- // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- [label setText:@""];
- [txtName setPlaceholder:@"Type your name"]; //ข้อความนำ
- ----------------------------------------------
- // controller.h
- #import <UIKit/UIKit.h>
- @interface HelloAgainViewController : UIViewController {
- IBOutlet UILabel * label;
- IBOutlet UITextField * txtName;
- }
- -(IBAction) sayHello;
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement