[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardDidShow:)
name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification object:nil];
#pragma mark -
- (void)keyboardWillShow:(NSNotification*)aNotification
{
XuChiLog(@"%@", NSStringFromSelector(_cmd));
NSDictionary* info = [aNotification userInfo];
CGSize bkbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
CGSize ekbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
XuChiLog(@"beginkeyBoard Size: %@", NSStringFromCGSize(bkbSize));
XuChiLog(@" endkeyBoard Size: %@", NSStringFromCGSize(ekbSize));
}
- (void)keyboardWillHide:(NSNotification*)aNotification
{
XuChiLog(@"%@", NSStringFromSelector(_cmd));
NSDictionary* info = [aNotification userInfo];
CGSize bkbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
CGSize ekbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
XuChiLog(@"beginkeyBoard Size: %@", NSStringFromCGSize(bkbSize));
XuChiLog(@" endkeyBoard Size: %@", NSStringFromCGSize(ekbSize));
}
- (void)keyboardDidShow:(NSNotification*)aNotification
{
XuChiLog(@"%@", NSStringFromSelector(_cmd));
NSDictionary* info = [aNotification userInfo];
CGSize bkbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
CGSize ekbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
XuChiLog(@"beginkeyBoard Size: %@", NSStringFromCGSize(bkbSize));
XuChiLog(@" endkeyBoard Size: %@", NSStringFromCGSize(ekbSize));
}
相关推荐
简单调用 导入文件 AppDelegate 实例化 ,在需要的类中实例化几句代码几个 重点在导入。
通过注册两个通知,可以监控键盘的弹出和消失,可以动态计算出键盘的高度。
tableviewcell 输入内容实时刷新高度 自适应高度 有不足的地方请指教 分享一些互相学习
应用ios8新特性,ios8下tableviewcell内容自适应
iOS 高度封装自适应表单(重构版) Github 地址: https://github.com/RockChanel/SWForm 简书地址: https://www.jianshu.com/p/2d2f742622fa
iOS 高度封装自适应表单(编辑及附件) 快捷构造复杂表单系统,包含编辑、附件功能 详细说明戳这里:https://www.jianshu.com/p/554c6c4c42d2
纯代码高度自适应
根据加载的html内容,自适应高度
UITableViewCell 动态高度计算 适用于ios8.0后 支持UITextView输入动态改变高度。
swift ,使用autolayout + storyboard 最外层tableview列表,cell里面嵌套了tableview,自适应内容,cell里的tableview不可滑动,内容全部显示,且文字分行显示,不用设置cell的高度直接可以自适应内容
UITableviewCell高度自适应
自定义Alert,自适应高度
TableVIew使用MMVC布局 ,cell点击展开高度自适应
解决输入键盘遮挡的问题,已经封装完毕,已经有使用举例方便大家使用
github地址: https://github.com/RockChanel/SWForm 欢迎 Star !!!!!
用通知中心,实现键盘自适应,为通信,评论等提供参考
根据加载的html内容,自适应高度
快捷构造复杂表单系统,包含编辑、附件功能 github地址:https://github.com/RockChanel/SelwynFormWithAttaDemo 详解戳这里:https://www.jianshu.com/p/554c6c4c42d2
支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于做最简单易用的AutoLayout库。 (此图示例详见demo7) 只需要3部设置就可以实现多cell的tableview高度自适应。 用到的库:...
根据图片比例自适应的瀑布流,非常适合图片社交软件的使用 因大小限制请去: https://github.com/jimmywu1992/JimmyLayout.git 下载。