IOS开发-QQ密码登录

退出软键盘两种方式:
保持意见: 请教大佬

IOS开发-QQ密码登录_第1张图片

//
//  ViewController.m
//  Created by qyg on 2018/7/10.
//  Copyright © 2018年 qyg. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
- (IBAction)login;

//用这两个属性描述
@property (weak, nonatomic) IBOutlet UITextField *qq;
@property (weak, nonatomic) IBOutlet UITextField *pwd;
-(IBAction)backgroundTap:(id)sender;
-(IBAction)textFieldReturnEditing:(id)sender;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (IBAction)login {
    NSLog(@"qq:%@  pwd:%@",self.qq.text,self.pwd.text);
}





//点击屏幕空白view时触发的事件
-(IBAction)backgroundTap:(id)sender{
    //通知文本失去第一响应者状态
    [sender resignFirstResponder];
}
//点击return时触发的事件B
-(IBAction)textFieldReturnEditing:(id)sender{
    [sender resignFirstResponder];
}
@end

你可能感兴趣的:(IOS,开发)