zoukankan      html  css  js  c++  java
  • 常见问题

    1、ios8.3上键盘莫名弹出

          工作中遇到这样一个问题,在某个界面上弹了个alertViewController后,进入下一个界面时,会莫名其妙的弹出一个键盘。

         hook了UIResponder的becomeFirstResponder后,发觉最后触发键盘的堆栈是这样子的:

         很清楚的表明,这次键盘莫名其妙的弹出是由UIAlertViewController触发的。在alertViewController消失的时候,会保存之前键盘的状态并恢复。

         奇怪的是,在这个键盘弹出前,我有让这个界面上所有的textField放弃第一响应者的。

          在stackOverflow上发现有人有类似的问题:

          http://stackoverflow.com/questions/30498972/keyboard-will-appeared-automatically-in-ios-8-3-while-displaying-alertview-or-al/30499931#30499931
          此人也是xcode6.3 ios8.3,测试了alertView的表现。
     
         下面提供的解决方法中:1、ios8之后,用UIAlertController来代替UIAlertView ,验证OK
         有人分析:
        1、当一个alert显示时,它会保存当前显示的键盘
        2、当这个alert结束了消失动画时,它会恢复之前保存的键盘。
         

        

    2、ios7上containsString会crash,改用rangeOfString

  • 相关阅读:
    游标cursor
    SQL: EXISTS
    LeetCode Reverse Integer
    LeetCode Same Tree
    LeetCode Maximum Depth of Binary Tree
    LeetCode 3Sum Closest
    LeetCode Linked List Cycle
    LeetCode Best Time to Buy and Sell Stock II
    LeetCode Balanced Binary Tree
    LeetCode Validate Binary Search Tree
  • 原文地址:https://www.cnblogs.com/wyqfighting/p/4618239.html
Copyright © 2011-2022 走看看