IQKeyboardReturnKeyHandler.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. //
  2. // IQKeyboardReturnKeyHandler.h
  3. // https://github.com/hackiftekhar/IQKeyboardManager
  4. // Copyright (c) 2013-16 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. #import "IQKeyboardManagerConstants.h"
  24. #import <Foundation/NSObject.h>
  25. #import <Foundation/NSObjCRuntime.h>
  26. #import <UIKit/UITextInputTraits.h>
  27. @class UITextField, UIView, UIViewController;
  28. @protocol UITextFieldDelegate, UITextViewDelegate;
  29. /**
  30. Manages the return key to work like next/done in a view hierarchy.
  31. */
  32. @interface IQKeyboardReturnKeyHandler : NSObject
  33. ///----------------------
  34. /// @name Initializations
  35. ///----------------------
  36. /**
  37. Add all the textFields available in UIViewController's view.
  38. */
  39. -(nonnull instancetype)initWithViewController:(nullable UIViewController*)controller NS_DESIGNATED_INITIALIZER;
  40. /**
  41. Unavailable. Please use initWithViewController: or init method
  42. */
  43. -(nonnull instancetype)initWithCoder:(nullable NSCoder *)aDecoder NS_UNAVAILABLE;
  44. ///---------------
  45. /// @name Settings
  46. ///---------------
  47. /**
  48. Delegate of textField/textView.
  49. */
  50. @property(nullable, nonatomic, weak) id<UITextFieldDelegate,UITextViewDelegate> delegate;
  51. /**
  52. Set the last textfield return key type. Default is UIReturnKeyDefault.
  53. */
  54. @property(nonatomic, assign) UIReturnKeyType lastTextFieldReturnKeyType;
  55. ///----------------------------------------------
  56. /// @name Registering/Unregistering textFieldView
  57. ///----------------------------------------------
  58. /**
  59. Should pass UITextField/UITextView instance. Assign textFieldView delegate to self, change it's returnKeyType.
  60. @param textFieldView UITextField/UITextView object to register.
  61. */
  62. -(void)addTextFieldView:(nonnull UIView*)textFieldView;
  63. /**
  64. Should pass UITextField/UITextView instance. Restore it's textFieldView delegate and it's returnKeyType.
  65. @param textFieldView UITextField/UITextView object to unregister.
  66. */
  67. -(void)removeTextFieldView:(nonnull UIView*)textFieldView;
  68. /**
  69. Add all the UITextField/UITextView responderView's.
  70. @param view object to register all it's responder subviews.
  71. */
  72. -(void)addResponderFromView:(nonnull UIView*)view;
  73. /**
  74. Remove all the UITextField/UITextView responderView's.
  75. @param view object to unregister all it's responder subviews.
  76. */
  77. -(void)removeResponderFromView:(nonnull UIView*)view;
  78. @end