keyboardWillChangeFrameNotification 引发的思考 是的 思考了很久终于出结果

时间:2024-09-22 11:04:08

func keyboardWillChangeFrameNotification(note: NSNotification) {

// TODO 添加键盘弹出的事件

let userinfo = note.userInfo!

let rect = userinfo[UIKeyboardFrameEndUserInfoKey]!.CGRectValue

var boardH = AppHeight - rect.origin.y

print("boardh: \(boardH),shit : \(i)")

i += 1

if boardH > 0 {

boardH = boardH + NavigationH           //键盘弹起  加回导航栏高度

}

backScrollView.contentSize = CGSizeMake(0, view.height + boardH)    //仔细查看 终于发现MD是不断增加ContentSize 高度,以至可以滑动看到东西

print("backScrollView.ContentSize: \(backScrollView.contentSize)")

print("backScrollView.frame: \(backScrollView.frame)")

print("viewHight : \(view.height) \n")

}