ios学习记录 UITextField输入return键监听
生活随笔
收集整理的这篇文章主要介绍了
ios学习记录 UITextField输入return键监听
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
2019独角兽企业重金招聘Python工程师标准>>>
#import <UIKit/UIKit.h>@interface ViewController : UIViewController<UITextFieldDelegate>{IBOutlet UITextField *_textField;} - (IBAction)pressButton:(UIButton *)sender; @end #import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad {[super viewDidLoad];_textField.delegate=self;// Do any additional setup after loading the view, typically from a nib. } - (BOOL)textFieldShouldReturn:(UITextField *)textField{[self pressButton:nil];return YES; } - (IBAction)pressButton:(UIButton *)sender {if([_textField isFirstResponder]){[_textField resignFirstResponder];}} @end
转载于:https://my.oschina.net/liyang2l/blog/76243
总结
以上是生活随笔为你收集整理的ios学习记录 UITextField输入return键监听的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 文件保存,String与int转换。
- 下一篇: 从零开始发布web项目(五)