-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Initial support for TopLayoutGuide and BottomLayoutGuide with M…
…anual Management. Moved 'UIView+IQKeyboardManagerAdditions' to separate category file Former-commit-id: b52ea92
- Loading branch information
1 parent
b05400d
commit 486a7ee
Showing
11 changed files
with
177 additions
and
30 deletions.
There are no files selected for viewing
Binary file not shown.
46 changes: 46 additions & 0 deletions
46
IQKeyBoardManager/Categories/IQUITextFieldView+Additions.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <UIKit/UIKit.h> | ||
|
||
/** | ||
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; |
54 changes: 54 additions & 0 deletions
54
IQKeyBoardManager/Categories/IQUITextFieldView+Additions.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <objc/runtime.h> | ||
|
||
@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; | ||
|
33 changes: 33 additions & 0 deletions
33
IQKeyBoardManager/Categories/IQUIViewController+Additions.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <UIKit/UIKit.h> | ||
|
||
@interface UIViewController (Additions) | ||
|
||
/** | ||
Top/Bottom Layout constraint which help library to manage keyboardTextField distance | ||
*/ | ||
@property(nonatomic, strong) IBOutlet NSLayoutConstraint *IQLayoutGuideConstraint; | ||
|
||
@end |
39 changes: 39 additions & 0 deletions
39
IQKeyBoardManager/Categories/IQUIViewController+Additions.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <objc/runtime.h> | ||
|
||
@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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
75c7be7ceb12526c9e315a339aa857e977ea869a | ||
54f99e0a0602d71225a6fb3526d0af9800d1149d |
2 changes: 1 addition & 1 deletion
2
...xcworkspace/xcuserdata/iftekhar.xcuserdatad/UserInterfaceState.xcuserstate.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
f6bc932d93abc06c16249b9d1b1716d2ffc4ae0b | ||
b8edd0e70f7d567c565d1d277920d03cbad35469 |
1 change: 1 addition & 0 deletions
1
KeyboardTextFieldDemo/Screenshot/BottomLayoutGuideIndirectMapping.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0648cc43c0204888d34815fb71a37289b7c0ebd6 |
1 change: 1 addition & 0 deletions
1
KeyboardTextFieldDemo/Screenshot/TopLayoutGuideDirectMapping.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0065327ad4c2872c16127587c6395fbbd75bca17 |
1 change: 1 addition & 0 deletions
1
KeyboardTextFieldDemo/Screenshot/TopLayoutGuideIndirectMapping.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ae7288e6f66b0d78d2fc7fa4b158822db4956ba2 |