一、获取键盘高度的方法:
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
//增加监听,当键盘出现或改变时接收消息
//加一个textField,以便可以弹出键盘
UITextField* textField = [[UITextField alloc]initWithFrame:CGRectMake(20, 100, 250, 40)];
textField.backgroundColor = [UIColor redColor];
textField.keyboardType = UIKeyboardTypeNumberPad; //键盘类型
[self.view addSubview:textField];
//增加监听,当键盘出现或改变时收出消息
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
//增加监听,当键退出时收出消息
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(k