-(void)adjustFrame
中。这也是IQKeyboardManager库最重要的方法,也是我们主要分析的方法。
-(void)adjustFrame
{
UIWindow *keyWindow = [self keyWindow];
//获取当前控制器
UIViewController *rootController = [_textFieldView topMostController];
if (rootController == nil) rootController = [keyWindow topMostWindowController];
//获取TextField(或TextView)的Frame
CGRect textFieldViewRect = [[_textFieldView superview] convertRect:_textFieldView.frame toView:keyWindow];
CGRect rootViewRect = [[rootController view] frame];
//省略部分代码....
//获取移动的高度,如果move是正值,说明textField被隐藏,否则则是被显示了
CGFloat move = 0;
if (layoutGuidePosition == IQLayoutGuidePositionBottom)
{
move = CGRectGetMaxY(textFieldViewRect)-(CGRectGetHeight(keyWindow.frame)-kbSize.height);
}
else
{
move = MIN(CGRectGetMinY(textFieldViewRect)-(topLayoutGuide+5), CGRectGetMaxY(textFieldViewRect)-(CGRectGetHeight(keyWindow.frame)-kbSize.height));
}
//省略部分代码...
//找到视图中可能存在的ScrollView
UIScrollView *superView = (UIScrollView*)[_textFieldView superviewOfClassType:[UIScrollView class]];
while (superView)
{
if (superView.isScrollEnabled && superView.shouldIgnoreScrollingAdjustment == NO)
{
superScrollView = superView;
break;
}
else
{
// Getting it's superScrollView. // (Enhancement ID: #21, #24)
superView = (UIScrollView*)[superView superviewOfClassType:[UIScrollView class]];
}
}
//以下代码是为了对获取到的ScrollView进行判断是否是当前遮盖键盘的ScrollView
if (_lastScrollView){
}{
}
//以下是对Top Layout guide做的特殊处理(如果大家不熟悉的话,没关系,大概意思就是做个兼容)
if (layoutGuidePosition == IQLayoutGuidePositionTop)
{
}
else if (layoutGuidePosition == IQLayoutGuidePositionBottom){
}
else//这里是核心的用于处理键盘遮挡的代码
{
//对textView可以通过设置ContentInset来达到效果
if ([_textFieldView isKindOfClass:[UITextView class]])
{
UIEdgeInsets newContentInset = textView.contentInset;
newContentInset.bottom = strongSelf.textFieldView.frame.size.height-textViewHeight;
textView.contentInset = newContentInset;
textView.scrollIndicatorInsets = newContentInset;
strongSelf.isTextViewContentInsetChanged = YES;
}
// 这里再对iPad做个特殊处理
if ([rootController modalPresentationStyle] == UIModalPresentationFormSheet ||
[rootController modalPresentationStyle] == UIModalPresentationPageSheet)
{
}
else
{
//这里是“核心中的核心”,设置View的Frame,以达到避免遮挡的目的。
[self setRootViewFrame:rootViewRect];
}
}
}
静态链接库实际上是一个目标文件的集合,其中的每个文件含有库中的一个或者一组相关函数的代码,静态链接则是把相关代码拷贝到源码相关位置处参与程序的生成。文本视图跑马灯效果 - 该源码实现了一款很不错的文本视图跑马灯效果,textview跑马灯,并且该效果可以自己滚动的,而且源... 2015-06-01。xcalablemp(xmp)是一个以分布式存储环境为对象,基于c语法和fortran语法指令扩展的pgas(分割全局地址空间模型)多线程并行编程语言,通过riken与筑波大学团队为xmp运行时库设计的源到源编译器omni xmp compiler和支持典型并联/单侧通信的全局视图/局部视图模型来将xmp-c或xmp-fortran的代码转换添加成适应本地编译器的并行代码,从而并发执行spmd(单过程多数据流)模式计算。
引用
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/sanxing/article-115497-2.html
但也绝不怕事