1. 程式人生 > >IOS開發-QQ密碼登入

IOS開發-QQ密碼登入

退出軟鍵盤兩種方式:
保持意見: 請教大佬

這裡寫圖片描述

//
//  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