-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVBEnhancedInputAccessoryView.h
More file actions
197 lines (177 loc) · 8.46 KB
/
VBEnhancedInputAccessoryView.h
File metadata and controls
197 lines (177 loc) · 8.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
//
// VBEnhancedInputAccessoryView.h
// VBEnhancedInputAccessoryView CLASS
//
// Created by Vitalii Budnik on 11/22/14.
// Copyright (c) 2014 iNekrich. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/**
* The VBEnhancedInputAccessoryViewDelegate protocol defines the messages
* sent to a VBEnhancedInputAccessoryView delegate as part of the sequence of navigating.
* All of the methods of this protocol are optional.
*/
@protocol VBEnhancedInputAccessoryViewDelegate <UIToolbarDelegate>
@optional
/**
* Tells the delegate that "Previous" button pressed in VBEnhancedInputAccessoryView
* for the specified text input view.
*
* This method notifies the delegate that the user wants to edit previous text field.
* You can use this method to update your delegate’s state information.
* For example, you might use this method to update your model, or view and handle
* navigation manually.
*
* Implementation of this method by the delegate is optional.
* @param object (UIView <UITextInputTraits> *) Current text field (current first responder on UIView)
* @param previousObject (UIView <UITextInputTraits> *) Previous text field in UIView.
* nil, if there are no previous text fields. (current text field is first)
*/
- (void)enhancedKeyboardPreviousDidTouchDownForObject:(UIView <UITextInputTraits> *)object withPreviousObject:(UIView <UITextInputTraits> *)previousObject;
/**
* Tells the delegate that "Next" button pressed in VBEnhancedInputAccessoryView
* for the specified text input view.
*
* This method notifies the delegate that the user wants to edit next text field.
* You can use this method to update your delegate’s state information.
* For example, you might use this method to update your model, or view and handle
* navigation manually.
*
* Implementation of this method by the delegate is optional.
* @param object (UIView <UITextInputTraits> *) Current text field (current first responder on UIView)
* @param nextObject (UIView <UITextInputTraits> *) Next text field in UIView.
* nil, if there are no next text fields. (current text field is last)
*/
- (void)enhancedKeyboardNextDidTouchDownForObject:(UIView <UITextInputTraits> *)object withNextObject:(UIView <UITextInputTraits> *)nextObject;
/**
* Tells the delegate that "Done" button pressed in VBEnhancedInputAccessoryView
* for the specified text input view.
*
* This method notifies the delegate that the user wants to end edit current text field.
* You can use this method to update your delegate’s state information.
* For example, you might use this method to update your model, or view and handle
* navigation manually.
*
* Implementation of this method by the delegate is optional.
* @param object (UIView <UITextInputTraits> *) Current text field (current first responder on UIView)
*/
- (void)enhancedKeyboardDoneDidTouchDownForObject:(UIView <UITextInputTraits> *)object;
@end
/**
* A VBEnhancedInputAccessoryView is a toolbar that displays "Next"/"Previous"/"Done" buttons
* for simple use as input accessory view in input controllers
*
* Can handle navigation through input controllers on your view by itself
*/
@interface VBEnhancedInputAccessoryView : UIToolbar
/// The receiver’s delegate.
@property (nonatomic, weak) id <VBEnhancedInputAccessoryViewDelegate> delegate;
/*
* Current object in view, that isFirstResponder, with active keyboard input view
* with this input accessory
*/
@property (weak, nonatomic) UIView <UITextInputTraits> *object;
/**
* Sets current objects, and reidentifying subviews for object.superview, that confirms
* to (UIView <UITextInputTraits> *) and can became first responder and not hidden. Recomended to use, when you need
* keyboard enchanced accessory view for new object, and changed accessability
* for some (UIView <UITextInputTraits> *) components on object.superview
*
* Recomended to use, when you need keyboard input accessory view for new object, and changed
* accessability (enabled, hidden) of other text inputs for some (UIView <UITextInputTraits> *)
* components or added/deleted ones on object.superview
*
* @param object A new (UIView <UITextInputTraits> *) object
* @param andReidentifyInputViews A Boolean, that indicates to reidentify or not other objects
* (`YES` - reidentify, 'NO' - not)
*/
- (void)setObject:(UIView <UITextInputTraits> *)object andReidentifyInputViews:(BOOL)reidentifyInputViews;
/**
* Sets current objects, and reidentifying subviews for objectSuperview parameter,
* that confirms to (UIView <UITextInputTraits> *) and can became first responder and not hidden.
*
* Recomended to use, when you need keyboard input accessory view for new object, and changed
* accessability (enabled, hidden) of other text inputs for some (UIView <UITextInputTraits> *)
* components or added/deleted ones on current objectSuperview
*
* @param object A new (UIView <UITextInputTraits> *) object
* @param andReidentifyInputViews A Boolean, that indicates to reidentify or not other objects
* (`YES` - reidentify, 'NO' - not)
*/
- (void)setObject:(UIView <UITextInputTraits> *)object locatedInSuperview:(UIView *)objectSuperview;
/**
* Sets current objects, and reidentifying subviews for objectSuperview parameter,
* that confirms to (UIView <UITextInputTraits> *) and can became first responder and not hidden.
*
* Recomended to use, when you need keyboard input accessory view for new object, and changed
* accessability (enabled, hidden) of other text inputs for some (UIView <UITextInputTraits> *)
* components or added/deleted ones on objectSuperview parameter
*
* @param object A new (UIView <UITextInputTraits> *) object
* @param objectSuperview A UIView that contains text inputs, but not equals superview of
* object parameter
* @param andReidentifyInputViews A Boolean, that indicates to reidentify or not other objects
* (`YES` - reidentify, 'NO' - not)
*/
- (void)setObject:(UIView <UITextInputTraits> *)object locatedInSuperview:(UIView *)objectSuperview andReidentifyInputViews:(BOOL)reidentifyInputViews;
/**
* Reidentifying subviews for objectSuperview parameter,
* that confirms to (UIView <UITextInputTraits> *) and can became first responder and not hidden.
*
* Recomended to use, when you need to update keyboard input accessory view for current object,
* and changed accessability (enabled, hidden) of other text inputs for some
* (UIView <UITextInputTraits> *) components or added/deleted ones on current objectSuperview
*/
- (void)reidentifyInputViewsAndUpdateNavigationAviability;
/**
* @discussion Returns a Boolean value indicating whether current object is not last text input
* @return NO if current object is the last text input view for current objectSuperview, YES -
* current object not last, and there are some text input views after it
*/
- (BOOL)isThereNextTextInput;
/**
* A Boolean value that indicates whether will handle target action for "Next"/"Previous" buttons
* located in segmented control (YES) or not (NO).
*
* If NO it will just delegate navigation events, if it can.
*
* If YES it will be searching for next/previous UIView <UITextInputTraits>, that can become
* a first responder and not hidden.
*
* Default value is YES
*/
@property (nonatomic) BOOL handlePreviousNextButtons;
/**
* A Boolean value that indicates whether will handle target action for "Done" button
*
* If NO it will just delegate navigation events, if it can.
*
* If YES it will hide keyboard, if current object (UIView <UITextInputTraits> *) is not last.
* If current object is last it will try to run textFieldShouldReturn: metod in delegate for
* object, if delegate conforms to protocol <UITextFieldDelegate> and can perfom that selector.
*
* Default value is YES
*/
@property (nonatomic) BOOL handleDoneButton;
/**
* A Boolean value that indicates is "Next"/"Previous" buttons that located in segmented control
* is on the left side of toolbar
*
* If setted to NO it show "Next"/"Previous" buttons on the right side of toolbar
*
* Default value is YES
*/
@property (nonatomic) BOOL navigationButtonsOnTheLeft;
/**
* A Boolean value that indicates whether will handle target action for "Done" button
*
* If NO it will handle next/previous item actions & aviability if them using
* NSArray of (UIView <UITextInputTraits> *)objects.
*
* If YES it handle next/previous item actions & aviability if them using searh for all objects
* in view with tag, that confirms to (UIView <UITextInputTraits> *) pointer. It's slow,
* and sometimes buggy.
*/
@property (nonatomic) BOOL navigateByTags;
@end