Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Action when pressing return key on keyboard (iOS)

- (BOOL)textFieldShouldReturn:(UITextField *)textField 
{
    [self checkRun:nil];
    return YES;
}

I'm trying to complete the IBAction checkRun when the return key is pressed, by using the above code, but it doesn't seem to be working. Where am I going wrong? I thought maybe it's because I'm not directly referencing the textfield that I'm typing in, but I can't work out where I'd need to put the name of that textfield.

Thanks in advance.

like image 450
Nathan Avatar asked Mar 16 '14 22:03

Nathan


People also ask

How do I activate the return button on my iPhone?

Tap “123” key in the bottom-left corner of the keyboard. 2. The Return key is located in the bottom-right corner, next to the space bar.

How do I get the return option on my keyboard?

key on the lower-right corner of the numeric keypad. And you can find the return key on the right side of the main alphanumeric portion of the keyboard. While on the ANSI keyboard, you can find the return key on the third row, above the right-hand Shift key and below the backslash \ key.

What is the Return key on Apple?

On a Mac, you'll see a Return key in the main alphanumeric section of the keyboard and an Enter key in the numeric keypad section of extended keyboards. This arrangement first appeared on the Apple Lisa keyboard in 1983 and carried over to the Mac Numeric Keypad in 1984 and the Mac Plus extended keyboard in 1986.

What is the Return key on my keyboard?

The Enter key was originally the "Return key" on a typewriter, which caused the carriage to return to the beginning of the next line on the paper. In a word processing or text editing application, pressing Enter ends a paragraph.


1 Answers

ViewController.h:

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController <UITextFieldDelegate>

@end

ViewController.m:

#import "ViewController.h"

@interface ViewController ()

@property (nonatomic, strong) UITextField *textField;

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.textField.delegate = self;
}
like image 133
klcjr89 Avatar answered Oct 02 '22 21:10

klcjr89