Created
July 9, 2012 19:45
-
-
Save chyld/3078475 to your computer and use it in GitHub Desktop.
iphone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface CMViewController : UIViewController | |
<UITextFieldDelegate> | |
{ | |
NSMutableArray* words; | |
IBOutlet UITextField* mytext; | |
} | |
- (IBAction)addItem:(id)sender; | |
- (IBAction)deleteAll:(id)sender; | |
@end | |
------------------------------------------------ | |
#import "CMViewController.h" | |
@interface CMViewController () | |
@end | |
@implementation CMViewController | |
- (IBAction)addItem:(id)sender | |
{ | |
[words addObject:mytext.text]; | |
} | |
- (IBAction)deleteAll:(id)sender | |
{ | |
words = [[NSMutableArray alloc] init]; | |
} | |
- (BOOL)textFieldShouldReturn:(UITextField *)textField | |
{ | |
[textField resignFirstResponder]; | |
return YES; | |
} | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// Do any additional setup after loading the view, typically from a nib. | |
} | |
- (void)viewDidUnload | |
{ | |
[super viewDidUnload]; | |
// Release any retained subviews of the main view. | |
} | |
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation | |
{ | |
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment