-(voID)vIEwWilldisappear:(BOol)animated{ [super vIEwWilldisappear:animated]; [self.TransitionCoordinator animatealongsIDeTransitionInVIEw:self.aTextinputVIEw.keyboardSuperVIEw animation:^(ID<UIVIEwControllerTransitionCoordinatorContext> context) { CGRect frame = self.aTextinputVIEw.keyboardSuperVIEw.frame; frame.origin.x = self.vIEw.frame.size.wIDth; self.aTextinputVIEw.keyboardSuperVIEw.frame = frame; } completion:nil];}
现在,当视图动画消失时,我得到的是键盘从屏幕动画到320点的x点,这就像我设置的那样有意义,我的问题是如何通过向后滑动让键盘动画?
更新
对于任何在视图消失时看到奇怪动画的人,您可以通过执行此 *** 作来移除键盘.
[self.TransitionCoordinator notifyWhenInteractionEndsUsingBlock:^(ID<UIVIEwControllerTransitionCoordinatorContext> context){ if (![context isCancelled]) { [keyboardSupervIEw removeFromSupervIEw]; }}];解决方法 你的代码片段中有很多自定义代码,如果我错了,请纠正我,但似乎你的self.aTextinputVIEw.keyboardSuperVIEw不正确.
仔细检查它是不是零.如果是,则忘记添加inputAccessoryVIEw.
以下是没有任何扩展名的完整代码段:
- (voID)vIEwWilldisappear:(BOol)animated{ [super vIEwWilldisappear:animated]; UIVIEw *keyboardSupervIEw = self.textFIEld.inputAccessoryVIEw.supervIEw; [self.TransitionCoordinator animatealongsIDeTransitionInVIEw:keyboardSupervIEw animation: ^(ID<UIVIEwControllerTransitionCoordinatorContext> context) { CGRect keyboardFrame = keyboardSupervIEw.frame; keyboardFrame.origin.x = self.vIEw.bounds.size.wIDth; keyboardSupervIEw.frame = keyboardFrame; } completion:nil];}- (voID)vIEwDIDLoad{ [super vIEwDIDLoad]; self.textFIEld.inputAccessoryVIEw = [[UIVIEw alloc] init];}总结
以上是内存溢出为你收集整理的在刷回iOS 7时保持UIKeyboard的视图全部内容,希望文章能够帮你解决在刷回iOS 7时保持UIKeyboard的视图所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)