Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

UITextField isn't working

By: a guest on Mar 29th, 2012  |  syntax: None  |  size: 0.63 KB  |  views: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. @interface practiceViewController : UIViewController <UITextFieldDelegate>
  2. {
  3.     UITextField *userInput;
  4. }
  5. @property (nonatomic, retain, readwrite) UITextField *userInput;
  6. @end
  7.        
  8. -(UITextField *)userInput{
  9. if (userInput == nil) {
  10.  
  11. userInput=[[UITextField alloc]init];
  12. userInput.keyboardType= UIKeyboardTypeNumberPad;
  13. userInput.returnKeyType= UIReturnKeyDone;
  14. userInput.textColor=[ UIColor redColor];
  15. userInput.clearButtonMode= UITextFieldViewModeWhileEditing;
  16. userInput.delegate = self;
  17. }
  18.  
  19. return userInput;
  20.        
  21. int nInput=[[userInput text] intValue];
  22.        
  23. int nInput = [[userInput text] intValue];
  24.        
  25. [self.view addSubview:self.userInput];