Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ If you want to have total control over what the **Previous** and **Next** button
1. Find all text fields and editable text views in the key window
2. Sort them using their frame origin vertical position

If you need notification of **Previous** and **Next** button presses, use the optional `changeBlock` property to add a block-based callback (but beware of `self` retain cycles!).

License
=======
The MIT License (MIT)
Expand All @@ -38,4 +40,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 changes: 4 additions & 0 deletions XCDFormInputAccessoryView/XCDFormInputAccessoryView.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#import <UIKit/UIKit.h>

typedef void(^XCDFormInputAccessoryViewChangeBlock)(UIResponder *newFirstResponder);

@interface XCDFormInputAccessoryView : UIView

- (id) initWithResponders:(NSArray *)responders; // Objects must be UIResponder instances
Expand All @@ -15,6 +17,8 @@

@property (nonatomic, assign) BOOL hasDoneButton; // Defaults to YES on iPhone, NO on iPad

@property (nonatomic, copy) XCDFormInputAccessoryViewChangeBlock changeBlock;

- (void) setHasDoneButton:(BOOL)hasDoneButton animated:(BOOL)animated;

@end
3 changes: 3 additions & 0 deletions XCDFormInputAccessoryView/XCDFormInputAccessoryView.m
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ - (void) selectAdjacentResponder:(UISegmentedControl *)sender
if (adjacentResponderIndex >= 0 && adjacentResponderIndex < (NSInteger)[self.responders count])
adjacentResponder = [self.responders objectAtIndex:adjacentResponderIndex];

if (self.changeBlock)
self.changeBlock(adjacentResponder);

[adjacentResponder becomeFirstResponder];
}

Expand Down