diff --git a/IQKeyBoardManager/.DS_Store b/IQKeyBoardManager/.DS_Store index a8a05d6d..ee5406f4 100644 Binary files a/IQKeyBoardManager/.DS_Store and b/IQKeyBoardManager/.DS_Store differ diff --git a/IQKeyBoardManager/Categories/IQUITextFieldView+Additions.h b/IQKeyBoardManager/Categories/IQUITextFieldView+Additions.h new file mode 100644 index 00000000..78114fb3 --- /dev/null +++ b/IQKeyBoardManager/Categories/IQUITextFieldView+Additions.h @@ -0,0 +1,46 @@ +// +// IQUITextFieldView+Additions.h +// https://github.com/hackiftekhar/IQKeyboardManager +// Copyright (c) 2013-15 Iftekhar Qurashi. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// 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. + +#import + +/** + UIView category for managing UITextField/UITextView + */ + +@interface UIView (Additions) + +/** + To set customized distance from keyboard for textField/textView. Can't be less than zero + */ +@property(nonatomic, assign) CGFloat keyboardDistanceFromTextField; + +@end + +///------------------------------------------- +/// @name Custom KeyboardDistanceFromTextField +///------------------------------------------- + +/** + Uses default keyboard distance for textField. + */ +extern CGFloat const kIQUseDefaultKeyboardDistance; diff --git a/IQKeyBoardManager/Categories/IQUITextFieldView+Additions.m b/IQKeyBoardManager/Categories/IQUITextFieldView+Additions.m new file mode 100644 index 00000000..8ef55a8b --- /dev/null +++ b/IQKeyBoardManager/Categories/IQUITextFieldView+Additions.m @@ -0,0 +1,54 @@ +// +// IQUITextFieldView+Additions.m +// https://github.com/hackiftekhar/IQKeyboardManager +// Copyright (c) 2013-15 Iftekhar Qurashi. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// 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. + +#import "IQUITextFieldView+Additions.h" +#import + +@implementation UIView (Additions) + +-(void)setKeyboardDistanceFromTextField:(CGFloat)keyboardDistanceFromTextField +{ + //Can't be less than zero. Minimum is zero. + keyboardDistanceFromTextField = MAX(keyboardDistanceFromTextField, 0); + + objc_setAssociatedObject(self, @selector(keyboardDistanceFromTextField), [NSNumber numberWithFloat:keyboardDistanceFromTextField], OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +-(CGFloat)keyboardDistanceFromTextField +{ + NSNumber *keyboardDistanceFromTextField = objc_getAssociatedObject(self, @selector(keyboardDistanceFromTextField)); + + return (keyboardDistanceFromTextField)?[keyboardDistanceFromTextField floatValue]:kIQUseDefaultKeyboardDistance; +} + +@end + +///------------------------------------ +/// @name keyboardDistanceFromTextField +///------------------------------------ + +/** + Uses default keyboard distance for textField. + */ +CGFloat const kIQUseDefaultKeyboardDistance = CGFLOAT_MAX; + diff --git a/IQKeyBoardManager/Categories/IQUIViewController+Additions.h b/IQKeyBoardManager/Categories/IQUIViewController+Additions.h new file mode 100644 index 00000000..dd51fa8b --- /dev/null +++ b/IQKeyBoardManager/Categories/IQUIViewController+Additions.h @@ -0,0 +1,33 @@ +// +// IQUIViewController+Additions.h +// https://github.com/hackiftekhar/IQKeyboardManager +// Copyright (c) 2013-15 Iftekhar Qurashi. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// 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. + +#import + +@interface UIViewController (Additions) + +/** + Top/Bottom Layout constraint which help library to manage keyboardTextField distance + */ +@property(nonatomic, strong) IBOutlet NSLayoutConstraint *IQLayoutGuideConstraint; + +@end diff --git a/IQKeyBoardManager/Categories/IQUIViewController+Additions.m b/IQKeyBoardManager/Categories/IQUIViewController+Additions.m new file mode 100644 index 00000000..d48636d5 --- /dev/null +++ b/IQKeyBoardManager/Categories/IQUIViewController+Additions.m @@ -0,0 +1,39 @@ +// +// IQUIViewController+Additions.m +// https://github.com/hackiftekhar/IQKeyboardManager +// Copyright (c) 2013-15 Iftekhar Qurashi. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// 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. + +#import "IQUIViewController+Additions.h" +#import + +@implementation UIViewController (Additions) + +-(void)setIQLayoutGuideConstraint:(NSLayoutConstraint *)IQLayoutGuideConstraint +{ + objc_setAssociatedObject(self, @selector(IQLayoutGuideConstraint), IQLayoutGuideConstraint, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +-(NSLayoutConstraint *)IQLayoutGuideConstraint +{ + return objc_getAssociatedObject(self, @selector(IQLayoutGuideConstraint)); +} + +@end diff --git a/IQKeyBoardManager/IQKeyboardManager.h b/IQKeyBoardManager/IQKeyboardManager.h index 0e35600b..699b86ef 100755 --- a/IQKeyBoardManager/IQKeyboardManager.h +++ b/IQKeyBoardManager/IQKeyboardManager.h @@ -295,31 +295,3 @@ extern NSInteger const kIQPreviousNextButtonToolbarTag; @end - - -///------------------------------------------- -/// @name Custom KeyboardDistanceFromTextField -///------------------------------------------- - -/** - Uses default keyboard distance for textField. - */ -extern CGFloat const kIQUseDefaultKeyboardDistance; - -/** - UIView category for IQKeyboardManager - */ -@interface UIView (IQKeyboardManagerAdditions) - -/** - To set customized distance from keyboard for textField/textView. Can't be less than zero - */ -//#if TARGET_INTERFACE_BUILDER -//@property(nonatomic, assign) IBInspectable CGFloat keyboardDistanceFromTextField; -//#else -@property(nonatomic, assign) CGFloat keyboardDistanceFromTextField; -//#endif - -@end - - diff --git a/IQKeyBoardManager/IQKeyboardManager.m.REMOVED.git-id b/IQKeyBoardManager/IQKeyboardManager.m.REMOVED.git-id index 4fba26e1..049f0948 100644 --- a/IQKeyBoardManager/IQKeyboardManager.m.REMOVED.git-id +++ b/IQKeyBoardManager/IQKeyboardManager.m.REMOVED.git-id @@ -1 +1 @@ -75c7be7ceb12526c9e315a339aa857e977ea869a \ No newline at end of file +54f99e0a0602d71225a6fb3526d0af9800d1149d \ No newline at end of file diff --git a/KeyboardTextFieldDemo/IQKeyboardManager.xcodeproj/project.xcworkspace/xcuserdata/iftekhar.xcuserdatad/UserInterfaceState.xcuserstate.REMOVED.git-id b/KeyboardTextFieldDemo/IQKeyboardManager.xcodeproj/project.xcworkspace/xcuserdata/iftekhar.xcuserdatad/UserInterfaceState.xcuserstate.REMOVED.git-id index a6a505d4..a2ef9410 100644 --- a/KeyboardTextFieldDemo/IQKeyboardManager.xcodeproj/project.xcworkspace/xcuserdata/iftekhar.xcuserdatad/UserInterfaceState.xcuserstate.REMOVED.git-id +++ b/KeyboardTextFieldDemo/IQKeyboardManager.xcodeproj/project.xcworkspace/xcuserdata/iftekhar.xcuserdatad/UserInterfaceState.xcuserstate.REMOVED.git-id @@ -1 +1 @@ -f6bc932d93abc06c16249b9d1b1716d2ffc4ae0b \ No newline at end of file +b8edd0e70f7d567c565d1d277920d03cbad35469 \ No newline at end of file diff --git a/KeyboardTextFieldDemo/Screenshot/BottomLayoutGuideIndirectMapping.jpg.REMOVED.git-id b/KeyboardTextFieldDemo/Screenshot/BottomLayoutGuideIndirectMapping.jpg.REMOVED.git-id new file mode 100644 index 00000000..5940d6da --- /dev/null +++ b/KeyboardTextFieldDemo/Screenshot/BottomLayoutGuideIndirectMapping.jpg.REMOVED.git-id @@ -0,0 +1 @@ +0648cc43c0204888d34815fb71a37289b7c0ebd6 \ No newline at end of file diff --git a/KeyboardTextFieldDemo/Screenshot/TopLayoutGuideDirectMapping.jpg.REMOVED.git-id b/KeyboardTextFieldDemo/Screenshot/TopLayoutGuideDirectMapping.jpg.REMOVED.git-id new file mode 100644 index 00000000..bb95d18c --- /dev/null +++ b/KeyboardTextFieldDemo/Screenshot/TopLayoutGuideDirectMapping.jpg.REMOVED.git-id @@ -0,0 +1 @@ +0065327ad4c2872c16127587c6395fbbd75bca17 \ No newline at end of file diff --git a/KeyboardTextFieldDemo/Screenshot/TopLayoutGuideIndirectMapping.jpg.REMOVED.git-id b/KeyboardTextFieldDemo/Screenshot/TopLayoutGuideIndirectMapping.jpg.REMOVED.git-id new file mode 100644 index 00000000..387f30bf --- /dev/null +++ b/KeyboardTextFieldDemo/Screenshot/TopLayoutGuideIndirectMapping.jpg.REMOVED.git-id @@ -0,0 +1 @@ +ae7288e6f66b0d78d2fc7fa4b158822db4956ba2 \ No newline at end of file