Nessuna descrizione

IQKeyboardManagerConstants.h 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. //
  2. // IQKeyboardManagerConstants.h
  3. // https://github.com/hackiftekhar/IQKeyboardManager
  4. // Copyright (c) 2013-15 Iftekhar Qurashi.
  5. //
  6. // Permission is hereby granted, free of charge, to any person obtaining a copy
  7. // of this software and associated documentation files (the "Software"), to deal
  8. // in the Software without restriction, including without limitation the rights
  9. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. // copies of the Software, and to permit persons to whom the Software is
  11. // furnished to do so, subject to the following conditions:
  12. //
  13. // The above copyright notice and this permission notice shall be included in
  14. // all copies or substantial portions of the Software.
  15. //
  16. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22. // THE SOFTWARE.
  23. #ifndef IQKeyboardManagerConstants_h
  24. #define IQKeyboardManagerConstants_h
  25. #import <Foundation/NSObjCRuntime.h>
  26. ///----------------
  27. /// @name Debugging
  28. ///----------------
  29. /**
  30. Set IQKEYBOARDMANAGER_DEBUG=1 in preprocessor macros under build settings to enable debugging.
  31. */
  32. ///-----------------------------------
  33. /// @name IQAutoToolbarManageBehaviour
  34. ///-----------------------------------
  35. /**
  36. `IQAutoToolbarBySubviews`
  37. Creates Toolbar according to subview's hirarchy of Textfield's in view.
  38. `IQAutoToolbarByTag`
  39. Creates Toolbar according to tag property of TextField's.
  40. `IQAutoToolbarByPosition`
  41. Creates Toolbar according to the y,x position of textField in it's superview coordinate.
  42. */
  43. typedef NS_ENUM(NSInteger, IQAutoToolbarManageBehaviour) {
  44. IQAutoToolbarBySubviews,
  45. IQAutoToolbarByTag,
  46. IQAutoToolbarByPosition,
  47. };
  48. ///-------------------
  49. /// @name Localization
  50. ///-------------------
  51. #define IQLocalizedString(key, comment) [[NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"IQKeyboardManager" ofType:@"bundle"]] localizedStringForKey:(key) value:@"" table:@"IQKeyboardManager"]
  52. /* XCode 5.0 Compatibility for NS_DESIGNATED_INITIALIZER*/
  53. #ifndef NS_DESIGNATED_INITIALIZER
  54. #if __has_attribute(objc_designated_initializer)
  55. #define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
  56. #else
  57. #define NS_DESIGNATED_INITIALIZER
  58. #endif
  59. #endif
  60. #endif
  61. /*
  62. /---------------------------------------------------------------------------------------------------\
  63. \---------------------------------------------------------------------------------------------------/
  64. | iOS NSNotification Mechanism |
  65. /---------------------------------------------------------------------------------------------------\
  66. \---------------------------------------------------------------------------------------------------/
  67. 1) Begin Editing:- When TextField begin editing.
  68. 2) End Editing:- When TextField end editing.
  69. 3) Switch TextField:- When Keyboard Switch from a TextField to another TextField.
  70. 3) Orientation Change:- When Device Orientation Change.
  71. ----------------------------------------------------------------------------------------------------------------------------------------------
  72. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  73. ----------------------------------------------------------------------------------------------------------------------------------------------
  74. =============
  75. UITextField
  76. =============
  77. Begin Editing Begin Editing
  78. -------------------------------------------- ---------------------------------- ---------------------------------
  79. |UITextFieldTextDidBeginEditingNotification| --------> | UIKeyboardWillShowNotification | --------> | UIKeyboardDidShowNotification |
  80. -------------------------------------------- ---------------------------------- ---------------------------------
  81. ^ Switch TextField ^ Switch TextField
  82. | |
  83. | |
  84. | Switch TextField | Orientation Change
  85. | |
  86. | |
  87. | |
  88. -------------------------------------------- | ---------------------------------- ---------------------------------
  89. | UITextFieldTextDidEndEditingNotification | <-------- | UIKeyboardWillHideNotification | --------> | UIKeyboardDidHideNotification |
  90. -------------------------------------------- ---------------------------------- ---------------------------------
  91. | End Editing ^
  92. | |
  93. |--------------------End Editing-------------------------------------------------------------|
  94. ----------------------------------------------------------------------------------------------------------------------------------------------
  95. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  96. ----------------------------------------------------------------------------------------------------------------------------------------------
  97. =============
  98. UITextView
  99. =============
  100. |-------------------Switch TextView--------------------------------------------------------------|
  101. | |------------------Begin Editing-------------------------------------------------------------| |
  102. | | | |
  103. v | Begin Editing Switch TextView v |
  104. -------------------------------------------- ---------------------------------- ---------------------------------
  105. | UITextViewTextDidBeginEditingNotification| <-------- | UIKeyboardWillShowNotification | --------> | UIKeyboardDidShowNotification |
  106. -------------------------------------------- ---------------------------------- ---------------------------------
  107. ^
  108. |
  109. |------------------------Switch TextView--------|
  110. | | Orientation Change
  111. | |
  112. | |
  113. | |
  114. -------------------------------------------- | ---------------------------------- ---------------------------------
  115. | UITextViewTextDidEndEditingNotification | <-------- | UIKeyboardWillHideNotification | | UIKeyboardDidHideNotification |
  116. -------------------------------------------- ---------------------------------- ---------------------------------
  117. | End Editing ^
  118. | |
  119. |--------------------End Editing-------------------------------------------------------------|
  120. ----------------------------------------------------------------------------------------------------------------------------------------------
  121. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  122. ----------------------------------------------------------------------------------------------------------------------------------------------
  123. */