zoukankan      html  css  js  c++  java
  • [转]How to hide inputAccessoryView without dismissing keyboard

    I am using a toolbar in the inputAccessoryView property of a textView. When the keyboard shows, it displays the toolbar as expected. When the device is rotated I want to remove the toolbar. I tried:

     myTextView.inputAccessoryView.hidden = !layoutIsPortrait;

    This does hide the toolbar, but leaves the outline of the taller keyboard behind. The keyboard is apparently still sized to fit the toolbar. It looks bad and interferes with touch events of underlying responders.

     myTextView.inputAccessoryView = nil;

    Works only if I resignFirstResponder, then becomeFirstResponder again. This is not acceptable. I lose the cursor placement and content of the textView, keyboard flashes out and back.

    [myTextView.inputAccessoryView removefromSuperview];

    Does nothing at all. I saved a reference to the toolbar in a iVar and addressed that instead,

    [myIvarReference removeFromSuperview];

    That works, but again the taller outline of the keyboard is faintly visible. This time it does not interfere with touches of other views. So now this is a working solution but visually unacceptable. What else can I try to show and hide the inputAccessoryView at will?

    Screenshot- the faint line above the keyboard is remnant of the removed toolbar

    Rotated keyboard with toolbar removed

    =================================================================================

    Never found a way to alter the frame of the keyboard. Ultimately decided to forego the inputAccessoryView, add my toolbar directly to the view as a subview and animate it myself along with the keyboard directly. This keeps the two independent and so, no more line.

  • 相关阅读:
    Java并发之同步原语
    Iterator与ListIterator的区别
    java集合之深入分析ArrayList
    深入分析HashMap
    ssm项目,web容器无法初始化项目
    疯狂java学习笔记
    Delphi 转载:图形的移动、交错、雨滴状、百页窗、积木堆叠等显现方式
    Delphi 转载:Delphi 如何GET/POST 调用HTTP请求
    Delphi 界面和组件背景透明相关方法
    Delphi 把Form界面设置有弧度的矩形
  • 原文地址:https://www.cnblogs.com/Proteas/p/2866120.html
Copyright © 2011-2022 走看看