I have used all the suggestions on the forum and still can not go from one uitextfield to the other by hitting the next button. Am i missing something or have something out of place. Any help would be great. Thanks.
Here is all of my code:
//.h file
#import <UIKit/UIKit.h>
@interface IncomeTransactionViewController : UIViewController
@property (strong, nonatomic) IBOutlet UITextField *businessField;
@property (strong, nonatomic) IBOutlet UITextField *memoField;
@property (strong, nonatomic) IBOutlet UITextField *amountField;
@end
//.m file
#import "IncomeTransactionViewController.h"
@interface IncomeTransactionViewController ()
@end
@implementation IncomeTransactionViewController
- (void)viewDidLoad
{
[super viewDidLoad];
//Business UITextField
self.businessField = [[UITextField alloc] initWithFrame:CGRectMake(20, 300, 280, 40)];
self.businessField.returnKeyType = UIReturnKeyNext;
self.businessField.placeholder = @"Business";
self.businessField.autocapitalizationType = UITextAutocapitalizationTypeWords;
self.businessField.adjustsFontSizeToFitWidth = TRUE;
self.businessField.borderStyle = UITextBorderStyleRoundedRect;
[self.view addSubview:self.businessField];
//Memo UITextField
self.memoField = [[UITextField alloc] initWithFrame:CGRectMake(20, 350, 280, 40)];
self.memoField.returnKeyType = UIReturnKeyNext;
self.memoField.placeholder = @"Memo";
self.memoField.autocapitalizationType = UITextAutocapitalizationTypeWords;
self.memoField.adjustsFontSizeToFitWidth = TRUE;
self.memoField.borderStyle = UITextBorderStyleRoundedRect;
[self.view addSubview:self.memoField];
//Amount UITextField
self.amountField = [[UITextField alloc] initWithFrame:CGRectMake(20, 400, 280, 40)];
self.amountField.returnKeyType = UIReturnKeyDone;
self.amountField.placeholder = @"Amount";
self.amountField.autocapitalizationType = UITextAutocapitalizationTypeWords;
self.amountField.adjustsFontSizeToFitWidth = TRUE;
self.amountField.borderStyle = UITextBorderStyleRoundedRect;
[self.view addSubview:self.amountField];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
if (textField == self.amountField) {
[textField resignFirstResponder];
} else if (textField == self.businessField) {
[self.businessField resignFirstResponder];
[self.memoField becomeFirstResponder];
} else if (textField == self.memoField) {
[self.memoField resignFirstResponder];
[self.amountField becomeFirstResponder];
}
return YES;
}
@end