1. 添加底部View,到最底部
底部View都是显示到最下面,并且都是固定死的,采用Xib或者storyboard搭建

2. 搭建底部View

3. 拖线
3.1 获取底部View距离底部的约束,做键盘弹出效果,底部View随着键盘弹出,而往上移动效果

// 监听键盘弹出
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];
// 键盘弹出会调用
- (void)keyboardWillChangeFrame:(NSNotification *)note
{
// 获取键盘frame
CGRect endFrame = [note.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
// 获取键盘弹出时长
CGFloat duration = [note.userInfo[UIKeyboardAnimationDurationUserInfoKey] floatValue];
// 修改底部视图距离底部的间距
_bottomCons.constant = _bottomCons.constant == 0?endFrame.size.height:0;
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
全部0条评论
快来发表一下你的评论吧 !