diff --git a/IQKeyBoardManager/Categories/IQNSArray+Sort.h b/IQKeyBoardManager/Categories/IQNSArray+Sort.h index 1052603..650b861 100644 --- a/IQKeyBoardManager/Categories/IQNSArray+Sort.h +++ b/IQKeyBoardManager/Categories/IQNSArray+Sort.h @@ -24,23 +24,21 @@ #import /** - @category NSArray (IQ_NSArray_Sort) - - @abstract UIView.subviews sorting category. + UIView.subviews sorting category. */ @interface NSArray (IQ_NSArray_Sort) +///-------------- +/// @name Sorting +///-------------- + /** - @method sortedArrayByTag - - @return Returns the array by sorting the UIView's by their tag property. + Returns the array by sorting the UIView's by their tag property. */ - (NSArray*)sortedArrayByTag; /** - @method sortedArrayByTag - - @return Returns the array by sorting the UIView's by their tag property. + Returns the array by sorting the UIView's by their tag property. */ - (NSArray*)sortedArrayByPosition; diff --git a/IQKeyBoardManager/Categories/IQNSArray+Sort.m b/IQKeyBoardManager/Categories/IQNSArray+Sort.m index 106cb7f..d57b0a3 100644 --- a/IQKeyBoardManager/Categories/IQNSArray+Sort.m +++ b/IQKeyBoardManager/Categories/IQNSArray+Sort.m @@ -49,14 +49,19 @@ { return [self sortedArrayUsingComparator:^NSComparisonResult(UIView *view1, UIView *view2) { - if (view1.IQ_y < view2.IQ_y) return NSOrderedAscending; + CGFloat x1 = CGRectGetMinX(view1.frame); + CGFloat y1 = CGRectGetMinY(view1.frame); + CGFloat x2 = CGRectGetMinX(view2.frame); + CGFloat y2 = CGRectGetMinY(view2.frame); - else if (view1.IQ_y > view2.IQ_y) return NSOrderedDescending; + if (y1 < y2) return NSOrderedAscending; + + else if (y1 > y2) return NSOrderedDescending; //Else both y are same so checking for x positions - else if (view1.IQ_x < view2.IQ_x) return NSOrderedAscending; + else if (x1 < x2) return NSOrderedAscending; - else if (view1.IQ_x > view2.IQ_x) return NSOrderedDescending; + else if (x1 > x2) return NSOrderedDescending; else return NSOrderedSame; }]; diff --git a/IQKeyBoardManager/Categories/IQUIView+Hierarchy.h b/IQKeyBoardManager/Categories/IQUIView+Hierarchy.h index aae9b82..2632f30 100644 --- a/IQKeyBoardManager/Categories/IQUIView+Hierarchy.h +++ b/IQKeyBoardManager/Categories/IQUIView+Hierarchy.h @@ -27,93 +27,91 @@ @class UICollectionView, UIScrollView, UITableView, NSArray; /** - @category UIView (IQ_UIView_Hierarchy) - - @abstract UIView hierarchy category. + UIView hierarchy category. */ @interface UIView (IQ_UIView_Hierarchy) +///------------------------------ +/// @name canBecomeFirstResponder +///------------------------------ + /** - @property isAskingCanBecomeFirstResponder - - @abstract Returns YES if IQKeyboardManager asking for `canBecomeFirstResponder. Useful when doing custom work in `textFieldShouldBeginEditing:` delegate. + Returns YES if IQKeyboardManager asking for `canBecomeFirstResponder. Useful when doing custom work in `textFieldShouldBeginEditing:` delegate. */ @property (nonatomic, readonly) BOOL isAskingCanBecomeFirstResponder; +///---------------------- +/// @name viewControllers +///---------------------- + /** - @property viewController - - @abstract Returns the UIViewController object that manages the receiver. + Returns the UIViewController object that manages the receiver. */ @property (nonatomic, readonly, strong) UIViewController *viewController; /** - @property topMostController - - @abstract Returns the topMost UIViewController object in hierarchy. + Returns the topMost UIViewController object in hierarchy. */ @property (nonatomic, readonly, strong) UIViewController *topMostController; +///----------------------------------- +/// @name Superviews/Subviews/Siglings +///----------------------------------- + /** - @method superviewOfClassType: - - @return Returns the superView of provided class type. + Returns the superView of provided class type. */ -(UIView*)superviewOfClassType:(Class)classType; /** - @property responderSiblings - - @abstract returns all siblings of the receiver which canBecomeFirstResponder. + Returns all siblings of the receiver which canBecomeFirstResponder. */ @property (nonatomic, readonly, copy) NSArray *responderSiblings; /** - @property deepResponderViews - - @abstract returns all deep subViews of the receiver which canBecomeFirstResponder. + Returns all deep subViews of the receiver which canBecomeFirstResponder. */ @property (nonatomic, readonly, copy) NSArray *deepResponderViews; +///------------------------- +/// @name Special TextFields +///------------------------- + /** - @property isSearchBarTextField - - @abstract returns YES if the receiver object is UISearchBarTextField, otherwise return NO. + Returns YES if the receiver object is UISearchBarTextField, otherwise return NO. */ @property (nonatomic, getter=isSearchBarTextField, readonly) BOOL searchBarTextField; /** - @property isAlertViewTextField - - @abstract returns YES if the receiver object is UIAlertSheetTextField, otherwise return NO. + Returns YES if the receiver object is UIAlertSheetTextField, otherwise return NO. */ @property (nonatomic, getter=isAlertViewTextField, readonly) BOOL alertViewTextField; +///---------------- +/// @name Transform +///---------------- + /** - @method convertTransformToView - - @return returns current view transform with respect to the 'toView'. + Returns current view transform with respect to the 'toView'. */ -(CGAffineTransform)convertTransformToView:(UIView*)toView; +///----------------- +/// @name Hierarchy +///----------------- + /** - @property subHierarchy - - @abstract Returns a string that represent the information about it's subview's hierarchy. You can use this method to debug the subview's positions. + Returns a string that represent the information about it's subview's hierarchy. You can use this method to debug the subview's positions. */ @property (nonatomic, readonly, copy) NSString *subHierarchy; /** - @property superHierarchy - - @abstract Returns an string that represent the information about it's upper hierarchy. You can use this method to debug the superview's positions. + Returns an string that represent the information about it's upper hierarchy. You can use this method to debug the superview's positions. */ @property (nonatomic, readonly, copy) NSString *superHierarchy; /** - @property debugHierarchy - - @abstract Returns an string that represent the information about it's frame positions. You can use this method to debug self positions. + Returns an string that represent the information about it's frame positions. You can use this method to debug self positions. */ @property (nonatomic, readonly, copy) NSString *debugHierarchy; @@ -121,29 +119,12 @@ /** - @category UIView (IQ_UIView_Frame) - - @abstract UIView frame category. + NSObject category to used for logging purposes */ -@interface UIView (IQ_UIView_Frame) - -@property (nonatomic, assign) CGPoint IQ_origin; -@property (nonatomic, assign) CGSize IQ_size; -@property (nonatomic, assign) CGFloat IQ_x, IQ_y, IQ_width, IQ_height; -@property (nonatomic, assign) CGFloat IQ_left, IQ_right, IQ_top, IQ_bottom; -@property (nonatomic, assign) CGFloat IQ_centerX; -@property (nonatomic, assign) CGFloat IQ_centerY; -@property (nonatomic, readonly) CGPoint IQ_boundsCenter; - -@end - - @interface NSObject (IQ_Logging) /** - @property _IQDescription - - @abstract Short description for logging purpose. + Short description for logging purpose. */ @property (nonatomic, readonly, copy) NSString *_IQDescription; diff --git a/IQKeyBoardManager/Categories/IQUIView+Hierarchy.m b/IQKeyBoardManager/Categories/IQUIView+Hierarchy.m index ef730ca..30555d1 100644 --- a/IQKeyBoardManager/Categories/IQUIView+Hierarchy.m +++ b/IQKeyBoardManager/Categories/IQUIView+Hierarchy.m @@ -180,11 +180,21 @@ Class UISearchBarTextFieldClass; //UISearchBar //subviews are returning in opposite order. So I sorted it according the frames 'y'. NSArray *subViews = [self.subviews sortedArrayUsingComparator:^NSComparisonResult(UIView *view1, UIView *view2) { - if (view1.IQ_y < view2.IQ_y) return NSOrderedAscending; + CGFloat x1 = CGRectGetMinX(view1.frame); + CGFloat y1 = CGRectGetMinY(view1.frame); + CGFloat x2 = CGRectGetMinX(view2.frame); + CGFloat y2 = CGRectGetMinY(view2.frame); - else if (view1.IQ_y > view2.IQ_y) return NSOrderedDescending; + if (y1 < y2) return NSOrderedAscending; - else return NSOrderedSame; + else if (y1 > y2) return NSOrderedDescending; + + //Else both y are same so checking for x positions + else if (x1 < x2) return NSOrderedAscending; + + else if (x1 > x2) return NSOrderedDescending; + + else return NSOrderedSame; }]; for (UITextField *textField in subViews) @@ -290,7 +300,7 @@ Class UISearchBarTextFieldClass; //UISearchBar { NSMutableString *debugInfo = [[NSMutableString alloc] init]; - [debugInfo appendFormat:@"%@: ( %.0f, %.0f, %.0f, %.0f )",NSStringFromClass([self class]),self.IQ_x,self.IQ_y,self.IQ_width,self.IQ_height]; + [debugInfo appendFormat:@"%@: ( %.0f, %.0f, %.0f, %.0f )",NSStringFromClass([self class]), CGRectGetMinX(self.frame), CGRectGetMinY(self.frame), CGRectGetWidth(self.frame), CGRectGetHeight(self.frame)]; if ([self isKindOfClass:[UIScrollView class]]) { @@ -318,110 +328,6 @@ Class UISearchBarTextFieldClass; //UISearchBar @end -@implementation UIView (IQ_UIView_Frame) - --(CGFloat)IQ_x { return CGRectGetMinX(self.frame); } --(CGFloat)IQ_y { return CGRectGetMinY(self.frame); } --(CGFloat)IQ_width { return CGRectGetWidth(self.frame); } --(CGFloat)IQ_height { return CGRectGetHeight(self.frame); } --(CGPoint)IQ_origin { return self.frame.origin; } --(CGSize)IQ_size { return self.frame.size; } --(CGFloat)IQ_left { return CGRectGetMinX(self.frame); } --(CGFloat)IQ_right { return CGRectGetMaxX(self.frame); } --(CGFloat)IQ_top { return CGRectGetMinY(self.frame); } --(CGFloat)IQ_bottom { return CGRectGetMaxY(self.frame); } --(CGFloat)IQ_centerX { return self.center.x; } --(CGFloat)IQ_centerY { return self.center.y; } --(CGPoint)IQ_boundsCenter { return CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)); }; - --(void)setIQ_x:(CGFloat)IQ_x -{ - CGRect frame = self.frame; - frame.origin.x = IQ_x; - self.frame = frame; -} - --(void)setIQ_y:(CGFloat)IQ_y -{ - CGRect frame = self.frame; - frame.origin.y = IQ_y; - self.frame = frame; -} - --(void)setIQ_width:(CGFloat)IQ_width -{ - CGRect frame = self.frame; - frame.size.width = IQ_width; - self.frame = frame; -} - --(void)setIQ_height:(CGFloat)IQ_height -{ - CGRect frame = self.frame; - frame.size.height = IQ_height; - self.frame = frame; -} - --(void)setIQ_origin:(CGPoint)IQ_origin -{ - CGRect frame = self.frame; - frame.origin = IQ_origin; - self.frame = frame; -} - --(void)setIQ_size:(CGSize)IQ_size -{ - CGRect frame = self.frame; - frame.size = IQ_size; - self.frame = frame; -} - --(void)setIQ_left:(CGFloat)IQ_left -{ - CGRect frame = self.frame; - frame.origin.x = IQ_left; - frame.size.width = MAX(self.IQ_right-IQ_left, 0); - self.frame = frame; -} - --(void)setIQ_right:(CGFloat)IQ_right -{ - CGRect frame = self.frame; - frame.size.width = MAX(IQ_right-self.IQ_left, 0); - self.frame = frame; -} - --(void)setIQ_top:(CGFloat)IQ_top -{ - CGRect frame = self.frame; - frame.origin.y = IQ_top; - frame.size.height = MAX(self.IQ_bottom-IQ_top, 0); - self.frame = frame; -} - --(void)setIQ_bottom:(CGFloat)IQ_bottom -{ - CGRect frame = self.frame; - frame.size.height = MAX(IQ_bottom-self.IQ_top, 0); - self.frame = frame; -} - --(void)setIQ_centerX:(CGFloat)IQ_centerX -{ - CGPoint center = self.center; - center.x = IQ_centerX; - self.center = center; -} - --(void)setIQ_centerY:(CGFloat)IQ_centerY -{ - CGPoint center = self.center; - center.y = IQ_centerY; - self.center = center; -} - -@end - @implementation NSObject (IQ_Logging) diff --git a/IQKeyBoardManager/Categories/IQUIWindow+Hierarchy.h b/IQKeyBoardManager/Categories/IQUIWindow+Hierarchy.h index 3140011..47c8da3 100644 --- a/IQKeyBoardManager/Categories/IQUIWindow+Hierarchy.h +++ b/IQKeyBoardManager/Categories/IQUIWindow+Hierarchy.h @@ -26,23 +26,21 @@ @class UIViewController; /** - @category UIWindow (IQ_UIWindow_Hierarchy) - - @abstract UIWindow hierarchy category. + UIWindow hierarchy category. */ @interface UIWindow (IQ_UIWindow_Hierarchy) +///---------------------- +/// @name viewControllers +///---------------------- + /** - @method topMostController - - @return Returns the current Top Most ViewController in hierarchy. + Returns the current Top Most ViewController in hierarchy. */ @property (nonatomic, readonly, strong) UIViewController *topMostController; /** - @method currentViewController - - @return Returns the topViewController in stack of topMostController. + Returns the topViewController in stack of topMostController. */ @property (nonatomic, readonly, strong) UIViewController *currentViewController; diff --git a/IQKeyBoardManager/Constants/IQKeyboardManagerConstants.h b/IQKeyBoardManager/Constants/IQKeyboardManagerConstants.h index 643c123..07f372f 100644 --- a/IQKeyBoardManager/Constants/IQKeyboardManagerConstants.h +++ b/IQKeyBoardManager/Constants/IQKeyboardManagerConstants.h @@ -26,49 +26,59 @@ #import -/* Set IQKEYBOARDMANAGER_DEBUG=1 in preprocessor macros under build settings to enable debugging.*/ +///---------------- +/// @name Debugging +///---------------- /** - @enum IQAutoToolbarManageBehaviour - - @abstract AutoToolbar manage settings. - - @const IQAutoToolbarBySubviews Creates Toolbar according to subview's hirarchy of Textfield's in view. - - @const IQAutoToolbarByTag Creates Toolbar according to tag property of TextField's. - - @const IQAutoToolbarByPosition Creates Toolbar according to the y,x position of textField in it's superview coordinate. + Set IQKEYBOARDMANAGER_DEBUG=1 in preprocessor macros under build settings to enable debugging. */ -#ifndef NS_ENUM +///----------------------------------- +/// @name IQAutoToolbarManageBehaviour +///----------------------------------- +/** + `IQAutoToolbarBySubviews` + Creates Toolbar according to subview's hirarchy of Textfield's in view. + + `IQAutoToolbarByTag` + Creates Toolbar according to tag property of TextField's. + + `IQAutoToolbarByPosition` + Creates Toolbar according to the y,x position of textField in it's superview coordinate. + */ +#ifndef NS_ENUM typedef enum IQAutoToolbarManageBehaviour { IQAutoToolbarBySubviews, IQAutoToolbarByTag, IQAutoToolbarByPosition, }IQAutoToolbarManageBehaviour; - #else - typedef NS_ENUM(NSInteger, IQAutoToolbarManageBehaviour) { IQAutoToolbarBySubviews, IQAutoToolbarByTag, IQAutoToolbarByPosition, }; - #endif +///------------------- +/// @name Localization +///------------------- + #define IQLocalizedString(key, comment) [[NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"IQKeyboardManager" ofType:@"bundle"]] localizedStringForKey:(key) value:@"" table:@"IQKeyboardManager"] -#endif /* XCode 5.0 Compatibility for NS_DESIGNATED_INITIALIZER*/ #ifndef NS_DESIGNATED_INITIALIZER -#if __has_attribute(objc_designated_initializer) -#define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) -#else -#define NS_DESIGNATED_INITIALIZER + #if __has_attribute(objc_designated_initializer) + #define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) + #else + #define NS_DESIGNATED_INITIALIZER + #endif #endif + + #endif /* diff --git a/IQKeyBoardManager/IQKeyboardManager.h b/IQKeyBoardManager/IQKeyboardManager.h index 59a6f1c..7160fa1 100755 --- a/IQKeyBoardManager/IQKeyboardManager.h +++ b/IQKeyBoardManager/IQKeyboardManager.h @@ -32,263 +32,215 @@ #if !(__has_feature(objc_instancetype)) - #define instancetype id +#define instancetype id #endif @class UIFont; -/** @const kIQDoneButtonToolbarTag Default tag for toolbar with Done button -1002. */ -extern NSInteger const kIQDoneButtonToolbarTag; -/* @const kIQPreviousNextButtonToolbarTag Default tag for toolbar with Previous/Next buttons -1005. */ -extern NSInteger const kIQPreviousNextButtonToolbarTag; - - /** - @author Iftekhar Qurashi - - @related hack.iftekhar@gmail.com - - @class IQKeyboardManager - - @abstract Keyboard TextField/TextView Manager. A generic version of KeyboardManagement. https://developer.apple.com/Library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html + Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more. A generic version of KeyboardManagement. https://developer.apple.com/Library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html */ @interface IQKeyboardManager : NSObject - -/*******************************************/ - - -//UIKeyboard handling +///-------------------------- +/// @name UIKeyboard handling +///-------------------------- /** - @method sharedManager - - @return Returns the default singleton instance. + Returns the default singleton instance. */ + (instancetype)sharedManager; /** - @property enable - - @abstract enable/disable managing distance between keyboard and textField. Default is YES(Enabled when class loads in `+(void)load` method). + Enable/disable managing distance between keyboard and textField. Default is YES(Enabled when class loads in `+(void)load` method). */ @property(nonatomic, assign, getter = isEnabled) BOOL enable; /** - @property keyboardDistanceFromTextField - - @abstract To set keyboard distance from textField. can't be less than zero. Default is 10.0. + To set keyboard distance from textField. can't be less than zero. Default is 10.0. */ @property(nonatomic, assign) CGFloat keyboardDistanceFromTextField; /** - @property preventShowingBottomBlankSpace - - @abstract Prevent keyboard manager to slide up the rootView to more than keyboard height. Default is YES. + Prevent keyboard manager to slide up the rootView to more than keyboard height. Default is YES. */ @property(nonatomic, assign) BOOL preventShowingBottomBlankSpace; - -/*******************************************/ - - -//IQToolbar handling +///------------------------- +/// @name IQToolbar handling +///------------------------- /** - @property enableAutoToolbar - - @abstract Automatic add the IQToolbar functionality. Default is YES. + Automatic add the IQToolbar functionality. Default is YES. */ @property(nonatomic, assign, getter = isEnableAutoToolbar) BOOL enableAutoToolbar; /** - @property toolbarManageStyle - - @abstract AutoToolbar managing behaviour. Default is IQAutoToolbarBySubviews. + AutoToolbar managing behaviour. Default is IQAutoToolbarBySubviews. */ @property(nonatomic, assign) IQAutoToolbarManageBehaviour toolbarManageBehaviour; #ifdef NSFoundationVersionNumber_iOS_6_1 - /** - @property shouldToolbarUsesTextFieldTintColor - - @abstract If YES, then uses textField's tintColor property for IQToolbar, otherwise tint color is black. Default is NO. + If YES, then uses textField's tintColor property for IQToolbar, otherwise tint color is black. Default is NO. */ -@property(nonatomic, assign) BOOL shouldToolbarUsesTextFieldTintColor NS_AVAILABLE_IOS(7_0); - +@property(nonatomic, assign) BOOL shouldToolbarUsesTextFieldTintColor; #endif /** - @property shouldShowTextFieldPlaceholder - - @abstract If YES, then it add the textField's placeholder text on IQToolbar. Default is YES. + If YES, then it add the textField's placeholder text on IQToolbar. Default is YES. */ @property(nonatomic, assign) BOOL shouldShowTextFieldPlaceholder; /** - @property placeholderFont - - @abstract Placeholder Font. Default is nil. + Placeholder Font. Default is nil. */ @property(nonatomic, strong) UIFont *placeholderFont; - -/*******************************************/ - - -//UITextView handling +///-------------------------- +/// @name UITextView handling +///-------------------------- /** - @property canAdjustTextView - - @abstract Adjust textView's frame when it is too big in height. Default is NO. + Adjust textView's frame when it is too big in height. Default is NO. */ @property(nonatomic, assign) BOOL canAdjustTextView; /** - @property shouldFixTextViewClip - - @abstract Adjust textView's contentInset to fix fix for iOS 7.0.x - http://stackoverflow.com/questions/18966675/uitextview-in-ios7-clips-the-last-line-of-text-string Default is YES. + Adjust textView's contentInset to fix fix for iOS 7.0.x - http://stackoverflow.com/questions/18966675/uitextview-in-ios7-clips-the-last-line-of-text-string Default is YES. */ @property(nonatomic, assign) BOOL shouldFixTextViewClip; - -/*******************************************/ - - -//UIKeyboard appearance overriding +///--------------------------------------- +/// @name UIKeyboard appearance overriding +///--------------------------------------- /** - @property overrideKeyboardAppearance - - @abstract Override the keyboardAppearance for all textField/textView. Default is NO. + Override the keyboardAppearance for all textField/textView. Default is NO. */ @property(nonatomic, assign) BOOL overrideKeyboardAppearance; /** - @property keyboardAppearance - - @abstract If overrideKeyboardAppearance is YES, then all the textField keyboardAppearance is set using this property. + If overrideKeyboardAppearance is YES, then all the textField keyboardAppearance is set using this property. */ @property(nonatomic, assign) UIKeyboardAppearance keyboardAppearance; - -/*******************************************/ - - -//UITextField/UITextView Resign handling +///--------------------------------------------- +/// @name UITextField/UITextView Resign handling +///--------------------------------------------- /** - @property shouldResignOnTouchOutside - - @abstract Resigns Keyboard on touching outside of UITextField/View. Default is NO. + Resigns Keyboard on touching outside of UITextField/View. Default is NO. */ @property(nonatomic, assign) BOOL shouldResignOnTouchOutside; /** - @method resignFirstResponder - - @abstract Resigns currently first responder field. + Resigns currently first responder field. */ - (void)resignFirstResponder; - -/*******************************************/ - -//UIScrollView handling +///---------------------------- +/// @name UIScrollView handling +///---------------------------- /** - @property shouldRestoreScrollViewContentOffset - - @abstract Restore scrollViewContentOffset when resigning from scrollView. Default is NO. + Restore scrollViewContentOffset when resigning from scrollView. Default is NO. */ @property(nonatomic, assign) BOOL shouldRestoreScrollViewContentOffset; - -//UISound handling +///------------------------------------------------ +/// @name UISound handling +///------------------------------------------------ /** - @property shouldPlayInputClicks - - @abstract If YES, then it plays inputClick sound on next/previous/done click. + If YES, then it plays inputClick sound on next/previous/done click. */ @property(nonatomic, assign) BOOL shouldPlayInputClicks; - -/*******************************************/ - - -//UIAnimation handling +///--------------------------- +/// @name UIAnimation handling +///--------------------------- /** - @property shouldAdoptDefaultKeyboardAnimation + If YES, then uses keyboard default animation curve style to move view, otherwise uses UIViewAnimationOptionCurveEaseInOut animation style. Default is YES. - @abstract If YES, then uses keyboard default animation curve style to move view, otherwise uses UIViewAnimationOptionCurveEaseInOut animation style. Default is YES. - - @discussion Sometimes strange animations may be produced if uses default curve style animation in iOS 7 and changing the textFields very frequently. + @warning Sometimes strange animations may be produced if uses default curve style animation in iOS 7 and changing the textFields very frequently. */ @property(nonatomic, assign) BOOL shouldAdoptDefaultKeyboardAnimation; - -/*******************************************/ - - -//Class Level disabling methods +///------------------------------------ +/// @name Class Level disabling methods +///------------------------------------ /** - @method disableInViewControllerClass: - @method removeDisableInViewControllerClass: + Disable adjusting view in disabledClass - @param disabledClass: Class in which library should not adjust view to show textField. + @param disabledClass Class in which library should not adjust view to show textField. */ -(void)disableInViewControllerClass:(Class)disabledClass; + +/** + Re-enable adjusting textField in disabledClass + + @param disabledClass Class in which library should re-enable adjust view to show textField. + */ -(void)removeDisableInViewControllerClass:(Class)disabledClass; /** - @method disableToolbarInViewControllerClass: - @method removeDisableToolbarInViewControllerClass: + Disable automatic toolbar creation in in toolbarDisabledClass - @param toolbarDisabledClass: Class in which library should not add toolbar over textField. + @param toolbarDisabledClass Class in which library should not add toolbar over textField. */ -(void)disableToolbarInViewControllerClass:(Class)toolbarDisabledClass; + +/** + Re-enable automatic toolbar creation in in toolbarDisabledClass + + @param toolbarDisabledClass Class in which library should re-enable automatic toolbar creation over textField. + */ -(void)removeDisableToolbarInViewControllerClass:(Class)toolbarDisabledClass; /** - @method considerToolbarPreviousNextInViewClass: - @method removeConsiderToolbarPreviousNextInViewClass: + Consider provided customView class as superView of all inner textField for calculating next/previous button logic. - @param toolbarPreviousNextConsideredClass: Custom UIView subclass Class in which library should consider all inner textField as siblings and add next/previous accordingly. + @param toolbarPreviousNextConsideredClass Custom UIView subclass Class in which library should consider all inner textField as siblings and add next/previous accordingly. */ -(void)considerToolbarPreviousNextInViewClass:(Class)toolbarPreviousNextConsideredClass; --(void)removeConsiderToolbarPreviousNextInViewClass:(Class)toolbarPreviousNextConsideredClass; - - -/*******************************************/ - - -//@final. Must not be used for subclassing. /** - @method init + Remove Consideration for provided customView class as superView of all inner textField for calculating next/previous button logic. - @abstract Should create only one instance of class. Should not call init. + @param toolbarPreviousNextConsideredClass Custom UIView subclass Class in which library should remove consideration for all inner textField as superView. + */ +-(void)removeConsiderToolbarPreviousNextInViewClass:(Class)toolbarPreviousNextConsideredClass; + +///------------------------------------------------ +/// @name Must not be used for subclassing. +///------------------------------------------------ + +/** + Should create only one instance of class. Should not call init. */ - (instancetype)init __attribute__((unavailable("init is not available in IQKeyboardManager, Use sharedManager"))) NS_DESIGNATED_INITIALIZER; /** - @method new - - @abstract Should create only one instance of class. Should not call new. + Should create only one instance of class. Should not call new. */ + (instancetype)new __attribute__((unavailable("new is not available in IQKeyboardManager, Use sharedManager"))); - -/*******************************************/ - - @end +///--------------------- +/// @name IQToolbar tags +///--------------------- +/** + Default tag for toolbar with Done button -1002. + */ +extern NSInteger const kIQDoneButtonToolbarTag; +/** + Default tag for toolbar with Previous/Next buttons -1005. + */ +extern NSInteger const kIQPreviousNextButtonToolbarTag; diff --git a/IQKeyBoardManager/IQKeyboardManager.m b/IQKeyBoardManager/IQKeyboardManager.m index 0cbb365..9a36d02 100755 --- a/IQKeyBoardManager/IQKeyboardManager.m +++ b/IQKeyBoardManager/IQKeyboardManager.m @@ -405,7 +405,7 @@ void _IQShowLog(NSString *logString); //frame size needs to be adjusted on iOS8 due to orientation API changes. if (IQ_IS_IOS8_OR_GREATER) { - frame.size = controller.view.IQ_size; + frame.size = controller.view.frame.size; } // If can't get rootViewController then printing warning to user. @@ -459,16 +459,16 @@ void _IQShowLog(NSString *logString); switch (interfaceOrientation) { case UIInterfaceOrientationLandscapeLeft: - move = MIN(CGRectGetMinX(textFieldViewRect)-(CGRectGetWidth(statusBarFrame)+5), CGRectGetMaxX(textFieldViewRect)-(keyWindow.IQ_width-_kbSize.width)); + move = MIN(CGRectGetMinX(textFieldViewRect)-(CGRectGetWidth(statusBarFrame)+5), CGRectGetMaxX(textFieldViewRect)-(CGRectGetWidth(keyWindow.frame)-_kbSize.width)); break; case UIInterfaceOrientationLandscapeRight: - move = MIN(keyWindow.IQ_width-CGRectGetMaxX(textFieldViewRect)-(CGRectGetWidth(statusBarFrame)+5), _kbSize.width-CGRectGetMinX(textFieldViewRect)); + move = MIN(CGRectGetWidth(keyWindow.frame)-CGRectGetMaxX(textFieldViewRect)-(CGRectGetWidth(statusBarFrame)+5), _kbSize.width-CGRectGetMinX(textFieldViewRect)); break; case UIInterfaceOrientationPortrait: - move = MIN(CGRectGetMinY(textFieldViewRect)-(CGRectGetHeight(statusBarFrame)+5), CGRectGetMaxY(textFieldViewRect)-(keyWindow.IQ_height-_kbSize.height)); + move = MIN(CGRectGetMinY(textFieldViewRect)-(CGRectGetHeight(statusBarFrame)+5), CGRectGetMaxY(textFieldViewRect)-(CGRectGetHeight(keyWindow.frame)-_kbSize.height)); break; case UIInterfaceOrientationPortraitUpsideDown: - move = MIN(keyWindow.IQ_height-CGRectGetMaxY(textFieldViewRect)-(CGRectGetHeight(statusBarFrame)+5), _kbSize.height-CGRectGetMinY(textFieldViewRect)); + move = MIN(CGRectGetHeight(keyWindow.frame)-CGRectGetMaxY(textFieldViewRect)-(CGRectGetHeight(statusBarFrame)+5), _kbSize.height-CGRectGetMinY(textFieldViewRect)); break; default: break; @@ -581,13 +581,13 @@ void _IQShowLog(NSString *logString); switch (interfaceOrientation) { case UIInterfaceOrientationLandscapeLeft: - bottom = _kbSize.width-(keyWindow.IQ_width-CGRectGetMaxX(lastScrollViewRect)); + bottom = _kbSize.width-(CGRectGetWidth(keyWindow.frame)-CGRectGetMaxX(lastScrollViewRect)); break; case UIInterfaceOrientationLandscapeRight: bottom = _kbSize.width-CGRectGetMinX(lastScrollViewRect); break; case UIInterfaceOrientationPortrait: - bottom = _kbSize.height-(keyWindow.IQ_height-CGRectGetMaxY(lastScrollViewRect)); + bottom = _kbSize.height-(CGRectGetHeight(keyWindow.frame)-CGRectGetMaxY(lastScrollViewRect)); break; case UIInterfaceOrientationPortraitUpsideDown: bottom = _kbSize.height-CGRectGetMinY(lastScrollViewRect); @@ -600,7 +600,6 @@ void _IQShowLog(NSString *logString); UIEdgeInsets movedInsets = _lastScrollView.contentInset; movedInsets.bottom = MAX(_startingContentInsets.bottom, bottom); -// movedInsets.bottom = MAX(0, (_lastScrollView.contentOffset.y+_lastScrollView.IQ_height)-MAX(_lastScrollView.contentSize.height, _lastScrollView.IQ_height)); _IQShowLog([NSString stringWithFormat:@"%@ old ContentInset : %@",[_lastScrollView _IQDescription], NSStringFromUIEdgeInsets(_lastScrollView.contentInset)]); @@ -626,17 +625,17 @@ void _IQShowLog(NSString *logString); //Added _isTextFieldViewFrameChanged. (Bug ID: #92) if (_canAdjustTextView && [_textFieldView isKindOfClass:[UITextView class]] && _keyboardManagerFlags.isTextFieldViewFrameChanged == NO) { - CGFloat textViewHeight = _textFieldView.IQ_height; + CGFloat textViewHeight = CGRectGetHeight(_textFieldView.frame); switch (interfaceOrientation) { case UIInterfaceOrientationLandscapeLeft: case UIInterfaceOrientationLandscapeRight: - textViewHeight = MIN(textViewHeight, (keyWindow.IQ_width-_kbSize.width-(CGRectGetWidth(statusBarFrame)+5))); + textViewHeight = MIN(textViewHeight, (CGRectGetWidth(keyWindow.frame)-_kbSize.width-(CGRectGetWidth(statusBarFrame)+5))); break; case UIInterfaceOrientationPortrait: case UIInterfaceOrientationPortraitUpsideDown: - textViewHeight = MIN(textViewHeight, (keyWindow.IQ_height-_kbSize.height-(CGRectGetHeight(statusBarFrame)+5))); + textViewHeight = MIN(textViewHeight, (CGRectGetHeight(keyWindow.frame)-_kbSize.height-(CGRectGetHeight(statusBarFrame)+5))); break; default: break; @@ -646,7 +645,9 @@ void _IQShowLog(NSString *logString); _IQShowLog([NSString stringWithFormat:@"%@ Old Frame : %@",[_textFieldView _IQDescription], NSStringFromCGRect(_textFieldView.frame)]); - _textFieldView.IQ_height = textViewHeight; + CGRect textFieldViewRect = _textFieldView.frame; + textFieldViewRect.size.height = textViewHeight; + _textFieldView.frame = textFieldViewRect; _keyboardManagerFlags.isTextFieldViewFrameChanged = YES; _IQShowLog([NSString stringWithFormat:@"%@ New Frame : %@",[_textFieldView _IQDescription], NSStringFromCGRect(_textFieldView.frame)]); @@ -675,10 +676,10 @@ void _IQShowLog(NSString *logString); { case UIInterfaceOrientationLandscapeLeft: case UIInterfaceOrientationLandscapeRight: - minimumY = keyWindow.IQ_width-rootViewRect.size.height-statusBarFrame.size.width-(_kbSize.width-_keyboardDistanceFromTextField); break; + minimumY = CGRectGetWidth(keyWindow.frame)-rootViewRect.size.height-statusBarFrame.size.width-(_kbSize.width-_keyboardDistanceFromTextField); break; case UIInterfaceOrientationPortrait: case UIInterfaceOrientationPortraitUpsideDown: - minimumY = (keyWindow.IQ_height-rootViewRect.size.height-statusBarFrame.size.height)/2-(_kbSize.height-_keyboardDistanceFromTextField); break; + minimumY = (CGRectGetHeight(keyWindow.frame)-rootViewRect.size.height-statusBarFrame.size.height)/2-(_kbSize.height-_keyboardDistanceFromTextField); break; default: break; } @@ -949,7 +950,7 @@ void _IQShowLog(NSString *logString); //frame size needs to be adjusted on iOS8 due to orientation API changes. if (IQ_IS_IOS8_OR_GREATER) { - _topViewBeginRect.size = _rootViewController.view.IQ_size; + _topViewBeginRect.size = _rootViewController.view.frame.size; } //Used UIViewAnimationOptionBeginFromCurrentState to minimize strange animations. diff --git a/IQKeyBoardManager/IQKeyboardReturnKeyHandler.h b/IQKeyBoardManager/IQKeyboardReturnKeyHandler.h index fa54f8a..e99e4ca 100644 --- a/IQKeyBoardManager/IQKeyboardReturnKeyHandler.h +++ b/IQKeyBoardManager/IQKeyboardReturnKeyHandler.h @@ -36,69 +36,67 @@ @class UITextField,UIView, UIViewController; /** - @author Iftekhar Qurashi - - @related hack.iftekhar@gmail.com - - @class IQKeyboardReturnKeyHandler - - @abstract Manages the return key to work like next/done in a view hierarchy. + Manages the return key to work like next/done in a view hierarchy. */ @interface IQKeyboardReturnKeyHandler : NSObject +///---------------------- +/// @name Initializations +///---------------------- + /** - @method initWithViewController - - @abstract Add all the textFields available in UIViewController's view. + Add all the textFields available in UIViewController's view. */ -(instancetype)initWithViewController:(UIViewController*)controller NS_DESIGNATED_INITIALIZER; +///--------------- +/// @name Settings +///--------------- + /** - @method delegate - - @abstract textField's delegates. + Delegate of textField/textView. */ @property(nonatomic, weak) id delegate; /** - @property toolbarManageBehaviour - - @abstract It help to choose the lastTextField instance from sibling responderViews. Default is IQAutoToolbarBySubviews. + It help to choose the lastTextField instance from sibling responderViews. Default is IQAutoToolbarBySubviews. */ @property(nonatomic, assign) IQAutoToolbarManageBehaviour toolbarManageBehaviour; /** - @property lastTextFieldReturnKeyType - - @abstract Set the last textfield return key type. Default is UIReturnKeyDefault. + Set the last textfield return key type. Default is UIReturnKeyDefault. */ @property(nonatomic, assign) UIReturnKeyType lastTextFieldReturnKeyType; +///---------------------------------------------- +/// @name Registering/Unregistering textFieldView +///---------------------------------------------- + /** - @method addTextFieldView + Should pass UITextField/UITextView intance. Assign textFieldView delegate to self, change it's returnKeyType. - @abstract Should pass UITextField/UITextView intance. Assign textFieldView delegate to self, change it's returnKeyType. + @param textFieldView UITextField/UITextView object to register. */ -(void)addTextFieldView:(UIView*)textFieldView; /** - @method removeTextFieldView - - @abstract Should pass UITextField/UITextView intance. Restore it's textFieldView delegate and it's returnKeyType. + Should pass UITextField/UITextView intance. Restore it's textFieldView delegate and it's returnKeyType. + + @param textFieldView UITextField/UITextView object to unregister. */ -(void)removeTextFieldView:(UIView*)textFieldView; /** - @method addResponderFromView + Add all the UITextField/UITextView responderView's. - @abstract Add all the UITextField/UITextView responderView's. + @param UIView object to register all it's responder subviews. */ -(void)addResponderFromView:(UIView*)view; /** - @method removeResponderFromView + Remove all the UITextField/UITextView responderView's. - @abstract Remove all the UITextField/UITextView responderView's. + @param UIView object to unregister all it's responder subviews. */ -(void)removeResponderFromView:(UIView*)view; diff --git a/IQKeyBoardManager/IQSegmentedNextPrevious/IQSegmentedNextPrevious.h b/IQKeyBoardManager/IQSegmentedNextPrevious/IQSegmentedNextPrevious.h index 94d0d88..3850bfd 100644 --- a/IQKeyBoardManager/IQSegmentedNextPrevious/IQSegmentedNextPrevious.h +++ b/IQKeyBoardManager/IQSegmentedNextPrevious/IQSegmentedNextPrevious.h @@ -33,39 +33,28 @@ /** - @class IQSegmentedNextPrevious + Custom SegmentedControl for Previous/Next button. - @deprecated Deprecated in iOS 7 - - @abstract Custom SegmentedControl for Previous/Next button. + @deprecated Deprecated in iOS 7 */ - @interface IQSegmentedNextPrevious : UISegmentedControl /** - @method initWithTarget:previousAction:nextAction: + Initialization function for IQSegmentedNextPrevious. - @abstract initialization function for IQSegmentedNextPrevious. - - @param target: Target object for selector. Usually 'self'. - - @param previousAction: Previous button action name. Usually 'previousAction:(IQSegmentedNextPrevious*)segmentedControl'. - - @param nextAction: Next button action name. Usually 'nextAction:(IQSegmentedNextPrevious*)segmentedControl'. + @param target Target object for selector. Usually 'self'. + @param previousAction Previous button action name. Usually 'previousAction:(IQSegmentedNextPrevious*)segmentedControl'. + @param nextAction Next button action name. Usually 'nextAction:(IQSegmentedNextPrevious*)segmentedControl'. */ - (instancetype)initWithTarget:(id)target previousAction:(SEL)previousAction nextAction:(SEL)nextAction NS_DESIGNATED_INITIALIZER; /** - @method init - - @abstract initWithTarget:previousAction:nextAction should be used. + initWithTarget:previousAction:nextAction should be used. */ - (instancetype)init __attribute__((unavailable("init is not available, should use initWithTarget:previousAction:nextAction instead"))); /** - @method init - - @abstract initWithTarget:previousAction:nextAction should be used. + initWithTarget:previousAction:nextAction should be used. */ + (instancetype)new __attribute__((unavailable("new is not available, should use initWithTarget:previousAction:nextAction instead"))); diff --git a/IQKeyBoardManager/IQTextView/IQTextView.h b/IQKeyBoardManager/IQTextView/IQTextView.h index 3c26257..b2b5715 100644 --- a/IQKeyBoardManager/IQTextView/IQTextView.h +++ b/IQKeyBoardManager/IQTextView/IQTextView.h @@ -26,16 +26,12 @@ #import /** - @class IQTextView - - @abstract UITextView with placeholder support + UITextView with placeholder support */ @interface IQTextView : UITextView /** - @property placeholder - - @abstract To set textView's placeholder text. Default is ni. + Set textView's placeholder text. Default is nil. */ @property(nonatomic,copy) NSString *placeholder; diff --git a/IQKeyBoardManager/IQToolbar/IQBarButtonItem.h b/IQKeyBoardManager/IQToolbar/IQBarButtonItem.h index abe22ea..3374716 100644 --- a/IQKeyBoardManager/IQToolbar/IQBarButtonItem.h +++ b/IQKeyBoardManager/IQToolbar/IQBarButtonItem.h @@ -25,11 +25,8 @@ #import /** - @class IQBarButtonItem - - @abstract IQBarButtonItem used for IQToolbar. + IQBarButtonItem used for IQToolbar. */ @interface IQBarButtonItem : UIBarButtonItem - @end diff --git a/IQKeyBoardManager/IQToolbar/IQTitleBarButtonItem.h b/IQKeyBoardManager/IQToolbar/IQTitleBarButtonItem.h index 5468509..91d0116 100644 --- a/IQKeyBoardManager/IQToolbar/IQTitleBarButtonItem.h +++ b/IQKeyBoardManager/IQToolbar/IQTitleBarButtonItem.h @@ -31,27 +31,20 @@ /** - @author Iftekhar Qurashi - - @related hack.iftekhar@gmail.com - - @class IQTitleBarButtonItem - - @abstract BarButtonItem with title text. + BarButtonItem with title text. */ @interface IQTitleBarButtonItem : IQBarButtonItem /** - @property font - - @abstract font to be used in bar button. Default is (system font 12.0 bold). + Font to be used in bar button. Default is (system font 12.0 bold). */ @property(nonatomic, strong) UIFont *font; /** - @method initWithFrame:title: + Initialize with frame and title. - @abstract initialize with frame and title. + @param frame Initial frame of barButtonItem + @param title Title of barButtonItem. */ -(instancetype)initWithFrame:(CGRect)frame title:(NSString *)title NS_DESIGNATED_INITIALIZER; diff --git a/IQKeyBoardManager/IQToolbar/IQToolbar.h b/IQKeyBoardManager/IQToolbar/IQToolbar.h index 9c22064..b0f9da7 100644 --- a/IQKeyBoardManager/IQToolbar/IQToolbar.h +++ b/IQKeyBoardManager/IQToolbar/IQToolbar.h @@ -24,25 +24,19 @@ #import /** - @class IQToolbar - - @abstract IQToolbar for IQKeyboardManager. + IQToolbar for IQKeyboardManager. */ @interface IQToolbar : UIToolbar /** - @property titleFont - - @abstract title font for toolbar. + Title font for toolbar. */ -@property(nonatomic, strong) UIFont *titleFont; +@property(nonatomic, strong) UIFont *titleFont; /** - @property title - - @abstract toolbar title + Toolbar title */ -@property(nonatomic, strong) NSString *title; +@property(nonatomic, strong) NSString *title; @end diff --git a/IQKeyBoardManager/IQToolbar/IQUIView+IQKeyboardToolbar.h b/IQKeyBoardManager/IQToolbar/IQUIView+IQKeyboardToolbar.h index 423e364..b45a200 100644 --- a/IQKeyBoardManager/IQToolbar/IQUIView+IQKeyboardToolbar.h +++ b/IQKeyBoardManager/IQToolbar/IQUIView+IQKeyboardToolbar.h @@ -27,140 +27,277 @@ @class UIBarButtonItem; /** - @category UIView (IQToolbarAddition) - - @abstract UIView category methods to add IQToolbar on UIKeyboard. + UIView category methods to add IQToolbar on UIKeyboard. */ @interface UIView (IQToolbarAddition) /** - @property shouldHideTitle - - @abstract if shouldHideTitle is YES, then title will not be added to the toolbar. Default to NO. + If shouldHideTitle is YES, then title will not be added to the toolbar. Default to NO. */ @property (assign, nonatomic) BOOL shouldHideTitle; +///----------------------------------------- +/// @name Customised Invocation Registration +///----------------------------------------- + /** - @method setCustomPreviousTarget:action: - @method setCustomNextTarget:action: - @method setCustomDoneTarget:action: + Additional target & action to do get callback action. Note that setting custom `previous` selector doesn't affect native `previous` functionality, this is just used to notifiy user to do additional work according to need. - @abstract Invoke action on target when the toolbar is created using IQKeyboardManager, you may add additional target & action to do get callback action. Note that setting custom previous/next/done selector doesn't affect native next/previous/done functionality, this is just used to notifiy user to do additional work according to your need. + @param target Target object. + @param action Target Selector. */ -(void)setCustomPreviousTarget:(id)target action:(SEL)action; + +/** + Additional target & action to do get callback action. Note that setting custom `next` selector doesn't affect native `next` functionality, this is just used to notifiy user to do additional work according to need. + + @param target Target object. + @param action Target Selector. + */ -(void)setCustomNextTarget:(id)target action:(SEL)action; + +/** + Additional target & action to do get callback action. Note that setting custom `done` selector doesn't affect native `done` functionality, this is just used to notifiy user to do additional work according to need. + + @param target Target object. + @param action Target Selector. + */ -(void)setCustomDoneTarget:(id)target action:(SEL)action; /** - @property previousInvocation - - @abstract customized Invocation to be called on previous arrow action. previousInvocation is internally created using setCustomPreviousTarget: method. + Customized Invocation to be called on previous arrow action. previousInvocation is internally created using setCustomPreviousTarget: method. */ @property (strong, nonatomic) NSInvocation *previousInvocation; /** - @property nextInvocation - - @abstract customized Invocation to be called on next arrow action. nextInvocation is internally created using setCustomNextTarget: method. + Customized Invocation to be called on next arrow action. nextInvocation is internally created using setCustomNextTarget: method. */ @property (strong, nonatomic) NSInvocation *nextInvocation; /** - @property nextInvocation - - @abstract customized Invocation to be called on done action. doneInvocation is internally created using setCustomDoneTarget: method. + Customized Invocation to be called on done action. doneInvocation is internally created using setCustomDoneTarget: method. */ @property (strong, nonatomic) NSInvocation *doneInvocation; +///------------ +/// @name Done +///------------ + /** - @method addDoneOnKeyboardWithTarget:action: - @method addDoneOnKeyboardWithTarget:action:titleText: - @method addDoneOnKeyboardWithTarget:action:shouldShowPlaceholder: - @method addRightButtonOnKeyboardWithText:target:action: - @method addRightButtonOnKeyboardWithText:target:action:titleText: - @method addRightButtonOnKeyboardWithText:target:action:shouldShowPlaceholder: + Helper function to add Done button on keyboard. - @abstract Helper functions to add Done button on keyboard. - - @param target: Target object for selector. Usually 'self'. - - @param action: Done button action name. Usually 'doneAction:(IQBarButtonItem*)item'. - - @param shouldShowPlaceholder: A boolean to indicate whether to show textField placeholder on IQToolbar'. - - @param titleText: text to show as title in IQToolbar'. + @param target Target object for selector. + @param action Done button action name. Usually 'doneAction:(IQBarButtonItem*)item'. */ - (void)addDoneOnKeyboardWithTarget:(id)target action:(SEL)action; -- (void)addDoneOnKeyboardWithTarget:(id)target action:(SEL)action titleText:(NSString*)titleText; -- (void)addDoneOnKeyboardWithTarget:(id)target action:(SEL)action shouldShowPlaceholder:(BOOL)showPlaceholder; -- (void)addRightButtonOnKeyboardWithText:(NSString*)text target:(id)target action:(SEL)action; -- (void)addRightButtonOnKeyboardWithText:(NSString*)text target:(id)target action:(SEL)action titleText:(NSString*)titleText; -- (void)addRightButtonOnKeyboardWithText:(NSString*)text target:(id)target action:(SEL)action shouldShowPlaceholder:(BOOL)showPlaceholder; /** - @method addCancelDoneOnKeyboardWithTarget:cancelAction:doneAction: - @method addCancelDoneOnKeyboardWithTarget:cancelAction:doneAction:titleText: - @method addCancelDoneOnKeyboardWithTarget:cancelAction:doneAction:shouldShowPlaceholder: - @method addLeftRightOnKeyboardWithTarget:leftButtonTitle:rightButtonTitle:leftButtonAction:rightButtonAction - @method addLeftRightOnKeyboardWithTarget:leftButtonTitle:rightButtonTitle:leftButtonAction:rightButtonAction:titleText: - @method addLeftRightOnKeyboardWithTarget:leftButtonTitle:rightButtonTitle:leftButtonAction:rightButtonAction:shouldShowPlaceholder: + Helper function to add Done button on keyboard. - @abstract Helper function to add Cancel and Done button on keyboard. + @param target Target object for selector. + @param action Done button action name. Usually 'doneAction:(IQBarButtonItem*)item'. + @param titleText text to show as title in IQToolbar'. + */ +- (void)addDoneOnKeyboardWithTarget:(id)target action:(SEL)action titleText:(NSString*)titleText; + +/** + Helper function to add Done button on keyboard. - @param target: Target object for selector. Usually 'self'. + @param target Target object for selector. + @param action Done button action name. Usually 'doneAction:(IQBarButtonItem*)item'. + @param shouldShowPlaceholder A boolean to indicate whether to show textField placeholder on IQToolbar'. + */ +- (void)addDoneOnKeyboardWithTarget:(id)target action:(SEL)action shouldShowPlaceholder:(BOOL)shouldShowPlaceholder; + +///------------ +/// @name Right +///------------ + +/** + Helper function to add Right button on keyboard. - @param cancelAction: Crevious button action name. Usually 'cancelAction:(IQBarButtonItem*)item'. + @param text Title for rightBarButtonItem, usually 'Done'. + @param target Target object for selector. + @param action Right button action name. Usually 'doneAction:(IQBarButtonItem*)item'. + */ +- (void)addRightButtonOnKeyboardWithText:(NSString*)text target:(id)target action:(SEL)action; + +/** + Helper function to add Right button on keyboard. - @param doneAction: Done button action name. Usually 'doneAction:(IQBarButtonItem*)item'. + @param text Title for rightBarButtonItem, usually 'Done'. + @param target Target object for selector. + @param action Right button action name. Usually 'doneAction:(IQBarButtonItem*)item'. + @param titleText text to show as title in IQToolbar'. + */ +- (void)addRightButtonOnKeyboardWithText:(NSString*)text target:(id)target action:(SEL)action titleText:(NSString*)titleText; + +/** + Helper function to add Right button on keyboard. - @param shouldShowPlaceholder: A boolean to indicate whether to show textField placeholder on IQToolbar'. + @param text Title for rightBarButtonItem, usually 'Done'. + @param target Target object for selector. + @param action Right button action name. Usually 'doneAction:(IQBarButtonItem*)item'. + @param shouldShowPlaceholder A boolean to indicate whether to show textField placeholder on IQToolbar'. + */ +- (void)addRightButtonOnKeyboardWithText:(NSString*)text target:(id)target action:(SEL)action shouldShowPlaceholder:(BOOL)shouldShowPlaceholder; + +///------------------ +/// @name Cancel/Done +///------------------ + +/** + Helper function to add Cancel and Done button on keyboard. - @param titleText: text to show as title in IQToolbar'. + @param target Target object for selector. + @param cancelAction Cancel button action name. Usually 'cancelAction:(IQBarButtonItem*)item'. + @param doneAction Done button action name. Usually 'doneAction:(IQBarButtonItem*)item'. */ - (void)addCancelDoneOnKeyboardWithTarget:(id)target cancelAction:(SEL)cancelAction doneAction:(SEL)doneAction; -- (void)addCancelDoneOnKeyboardWithTarget:(id)target cancelAction:(SEL)cancelAction doneAction:(SEL)doneAction titleText:(NSString*)titleText; -- (void)addCancelDoneOnKeyboardWithTarget:(id)target cancelAction:(SEL)cancelAction doneAction:(SEL)doneAction shouldShowPlaceholder:(BOOL)showPlaceholder; -- (void)addLeftRightOnKeyboardWithTarget:(id)target leftButtonTitle:(NSString*)leftTitle rightButtonTitle:(NSString*)rightTitle leftButtonAction:(SEL)leftAction rightButtonAction:(SEL)rightAction; -- (void)addLeftRightOnKeyboardWithTarget:(id)target leftButtonTitle:(NSString*)leftTitle rightButtonTitle:(NSString*)rightTitle leftButtonAction:(SEL)leftAction rightButtonAction:(SEL)rightAction titleText:(NSString*)titleText; -- (void)addLeftRightOnKeyboardWithTarget:(id)target leftButtonTitle:(NSString*)leftTitle rightButtonTitle:(NSString*)rightTitle leftButtonAction:(SEL)leftAction rightButtonAction:(SEL)rightAction shouldShowPlaceholder:(BOOL)showPlaceholder; /** - @method addPreviousNextDoneOnKeyboardWithTarget:previousAction:nextAction:doneAction - @method addPreviousNextDoneOnKeyboardWithTarget:previousAction:nextAction:doneAction:titleText: - @method addPreviousNextDoneOnKeyboardWithTarget:previousAction:nextAction:doneAction:shouldShowPlaceholder: - @method addPreviousNextRightOnKeyboardWithTarget:rightButtonTitle:previousAction:nextAction:rightButtonAction - @method addPreviousNextRightOnKeyboardWithTarget:rightButtonTitle:previousAction:nextAction:rightButtonAction:titleText: - @method addPreviousNextRightOnKeyboardWithTarget:rightButtonTitle:previousAction:nextAction:rightButtonAction:shouldShowPlaceholder: + Helper function to add Cancel and Done button on keyboard. - @abstract Helper function to add SegmentedNextPrevious and Done button on keyboard. + @param target Target object for selector. + @param cancelAction Cancel button action name. Usually 'cancelAction:(IQBarButtonItem*)item'. + @param doneAction Done button action name. Usually 'doneAction:(IQBarButtonItem*)item'. + @param titleText text to show as title in IQToolbar'. + */ +- (void)addCancelDoneOnKeyboardWithTarget:(id)target cancelAction:(SEL)cancelAction doneAction:(SEL)doneAction titleText:(NSString*)titleText; + +/** + Helper function to add Cancel and Done button on keyboard. - @param target: Target object for selector. Usually 'self'. + @param target Target object for selector. + @param cancelAction Cancel button action name. Usually 'cancelAction:(IQBarButtonItem*)item'. + @param doneAction Done button action name. Usually 'doneAction:(IQBarButtonItem*)item'. + @param shouldShowPlaceholder A boolean to indicate whether to show textField placeholder on IQToolbar'. + */ +- (void)addCancelDoneOnKeyboardWithTarget:(id)target cancelAction:(SEL)cancelAction doneAction:(SEL)doneAction shouldShowPlaceholder:(BOOL)shouldShowPlaceholder; + +///----------------- +/// @name Right/Left +///----------------- + +/** + Helper function to add Left and Right button on keyboard. - @param previousAction: Previous button action name. Usually 'previousAction:(IQSegmentedNextPrevious*)segmentedControl'. + @param target Target object for selector. + @param leftButtonTitle Title for leftBarButtonItem, usually 'Cancel'. + @param rightButtonTitle Title for rightBarButtonItem, usually 'Done'. + @param leftButtonAction Left button action name. Usually 'cancelAction:(IQBarButtonItem*)item'. + @param rightButtonAction Right button action name. Usually 'doneAction:(IQBarButtonItem*)item'. + */ +- (void)addLeftRightOnKeyboardWithTarget:(id)target leftButtonTitle:(NSString*)leftButtonTitle rightButtonTitle:(NSString*)rightButtonTitle leftButtonAction:(SEL)leftButtonAction rightButtonAction:(SEL)rightButtonAction; + +/** + Helper function to add Left and Right button on keyboard. - @param nextAction: Next button action name. Usually 'nextAction:(IQSegmentedNextPrevious*)segmentedControl'. + @param target Target object for selector. + @param leftButtonTitle Title for leftBarButtonItem, usually 'Cancel'. + @param rightButtonTitle Title for rightBarButtonItem, usually 'Done'. + @param leftButtonAction Left button action name. Usually 'cancelAction:(IQBarButtonItem*)item'. + @param rightButtonAction Right button action name. Usually 'doneAction:(IQBarButtonItem*)item'. + @param titleText text to show as title in IQToolbar'. + */ +- (void)addLeftRightOnKeyboardWithTarget:(id)target leftButtonTitle:(NSString*)leftButtonTitle rightButtonTitle:(NSString*)rightButtonTitle leftButtonAction:(SEL)leftButtonAction rightButtonAction:(SEL)rightButtonAction titleText:(NSString*)titleText; + +/** + Helper function to add Left and Right button on keyboard. - @param doneAction: Done button action name. Usually 'doneAction:(IQBarButtonItem*)item'. + @param target Target object for selector. + @param leftButtonTitle Title for leftBarButtonItem, usually 'Cancel'. + @param rightButtonTitle Title for rightBarButtonItem, usually 'Done'. + @param leftButtonAction Left button action name. Usually 'cancelAction:(IQBarButtonItem*)item'. + @param rightButtonAction Right button action name. Usually 'doneAction:(IQBarButtonItem*)item'. + @param shouldShowPlaceholder A boolean to indicate whether to show textField placeholder on IQToolbar'. + */ +- (void)addLeftRightOnKeyboardWithTarget:(id)target leftButtonTitle:(NSString*)leftButtonTitle rightButtonTitle:(NSString*)rightButtonTitle leftButtonAction:(SEL)leftButtonAction rightButtonAction:(SEL)rightButtonAction shouldShowPlaceholder:(BOOL)shouldShowPlaceholder; + +///------------------------- +/// @name Previous/Next/Done +///------------------------- + +/** + Helper function to add SegmentedNextPrevious/ArrowNextPrevious and Done button on keyboard. - @param shouldShowPlaceholder: A boolean to indicate whether to show textField placeholder on IQToolbar'. - - @param titleText: text to show as title in IQToolbar'. + @param target Target object for selector. + @param previousAction Previous button action name. Usually 'previousAction:(id)item'. + @param nextAction Next button action name. Usually 'nextAction:(id)item'. + @param doneAction Done button action name. Usually 'doneAction:(IQBarButtonItem*)item'. */ - (void)addPreviousNextDoneOnKeyboardWithTarget:(id)target previousAction:(SEL)previousAction nextAction:(SEL)nextAction doneAction:(SEL)doneAction; -- (void)addPreviousNextDoneOnKeyboardWithTarget:(id)target previousAction:(SEL)previousAction nextAction:(SEL)nextAction doneAction:(SEL)doneAction titleText:(NSString*)titleText; -- (void)addPreviousNextDoneOnKeyboardWithTarget:(id)target previousAction:(SEL)previousAction nextAction:(SEL)nextAction doneAction:(SEL)doneAction shouldShowPlaceholder:(BOOL)showPlaceholder; -- (void)addPreviousNextRightOnKeyboardWithTarget:(id)target rightButtonTitle:(NSString*)rightButtonTitle previousAction:(SEL)previousAction nextAction:(SEL)nextAction rightButtonAction:(SEL)rightButtonAction; -- (void)addPreviousNextRightOnKeyboardWithTarget:(id)target rightButtonTitle:(NSString*)rightButtonTitle previousAction:(SEL)previousAction nextAction:(SEL)nextAction rightButtonAction:(SEL)rightButtonAction titleText:(NSString*)titleText; -- (void)addPreviousNextRightOnKeyboardWithTarget:(id)target rightButtonTitle:(NSString*)rightButtonTitle previousAction:(SEL)previousAction nextAction:(SEL)nextAction rightButtonAction:(SEL)rightButtonAction shouldShowPlaceholder:(BOOL)showPlaceholder; /** - @method setEnablePrevious:next: + Helper function to add SegmentedNextPrevious/ArrowNextPrevious and Done button on keyboard. - @abstract Helper function to enable and disable previous next buttons. + @param target Target object for selector. + @param previousAction Previous button action name. Usually 'previousAction:(id)item'. + @param nextAction Next button action name. Usually 'nextAction:(id)item'. + @param doneAction Done button action name. Usually 'doneAction:(IQBarButtonItem*)item'. + @param titleText text to show as title in IQToolbar'. + */ +- (void)addPreviousNextDoneOnKeyboardWithTarget:(id)target previousAction:(SEL)previousAction nextAction:(SEL)nextAction doneAction:(SEL)doneAction titleText:(NSString*)titleText; + +/** + Helper function to add SegmentedNextPrevious/ArrowNextPrevious and Done button on keyboard. - @param isPreviousEnabled: BOOL to enable/disable previous button on keyboard. + @param target Target object for selector. + @param previousAction Previous button action name. Usually 'previousAction:(id)item'. + @param nextAction Next button action name. Usually 'nextAction:(id)item'. + @param doneAction Done button action name. Usually 'doneAction:(IQBarButtonItem*)item'. + @param shouldShowPlaceholder A boolean to indicate whether to show textField placeholder on IQToolbar'. + */ +- (void)addPreviousNextDoneOnKeyboardWithTarget:(id)target previousAction:(SEL)previousAction nextAction:(SEL)nextAction doneAction:(SEL)doneAction shouldShowPlaceholder:(BOOL)shouldShowPlaceholder; + +///-------------------------- +/// @name Previous/Next/Right +///-------------------------- + +/** + Helper function to add SegmentedNextPrevious/ArrowNextPrevious and Right button on keyboard. - @param isNextEnabled: BOOL to enable/disable next button on keyboard.. + @param target Target object for selector. + @param rightButtonTitle Title for rightBarButtonItem, usually 'Done'. + @param previousAction Previous button action name. Usually 'previousAction:(id)item'. + @param nextAction Next button action name. Usually 'nextAction:(id)item'. + @param rightButtonAction RightBarButton action name. Usually 'doneAction:(IQBarButtonItem*)item'. + */ +- (void)addPreviousNextRightOnKeyboardWithTarget:(id)target rightButtonTitle:(NSString*)rightButtonTitle previousAction:(SEL)previousAction nextAction:(SEL)nextAction rightButtonAction:(SEL)rightButtonAction; + +/** + Helper function to add SegmentedNextPrevious/ArrowNextPrevious and Right button on keyboard. + + @param target Target object for selector. + @param rightButtonTitle Title for rightBarButtonItem, usually 'Done'. + @param previousAction Previous button action name. Usually 'previousAction:(id)item'. + @param nextAction Next button action name. Usually 'nextAction:(id)item'. + @param rightButtonAction RightBarButton action name. Usually 'doneAction:(IQBarButtonItem*)item'. + @param titleText text to show as title in IQToolbar'. + */ +- (void)addPreviousNextRightOnKeyboardWithTarget:(id)target rightButtonTitle:(NSString*)rightButtonTitle previousAction:(SEL)previousAction nextAction:(SEL)nextAction rightButtonAction:(SEL)rightButtonAction titleText:(NSString*)titleText; + +/** + Helper function to add SegmentedNextPrevious/ArrowNextPrevious and Right button on keyboard. + + @param target Target object for selector. + @param rightButtonTitle Title for rightBarButtonItem, usually 'Done'. + @param previousAction Previous button action name. Usually 'previousAction:(id)item'. + @param nextAction Next button action name. Usually 'nextAction:(id)item'. + @param rightButtonAction RightBarButton action name. Usually 'doneAction:(IQBarButtonItem*)item'. + @param shouldShowPlaceholder A boolean to indicate whether to show textField placeholder on IQToolbar'. + */ +- (void)addPreviousNextRightOnKeyboardWithTarget:(id)target rightButtonTitle:(NSString*)rightButtonTitle previousAction:(SEL)previousAction nextAction:(SEL)nextAction rightButtonAction:(SEL)rightButtonAction shouldShowPlaceholder:(BOOL)shouldShowPlaceholder; + +///----------------------------------- +/// @name Enable/Disable Previous/Next +///----------------------------------- + +/** + Helper function to enable and disable previous next buttons. + + @param isPreviousEnabled BOOL to enable/disable previous button on keyboard. + @param isNextEnabled BOOL to enable/disable next button on keyboard.. */ - (void)setEnablePrevious:(BOOL)isPreviousEnabled next:(BOOL)isNextEnabled; diff --git a/KeyboardTextFieldDemo/.DS_Store b/KeyboardTextFieldDemo/.DS_Store index 474fa83..9e64480 100644 Binary files a/KeyboardTextFieldDemo/.DS_Store and b/KeyboardTextFieldDemo/.DS_Store differ