Skip to content

Commit 486a7ee

Browse files
committed
Added Initial support for TopLayoutGuide and BottomLayoutGuide with Manual Management. Moved 'UIView+IQKeyboardManagerAdditions' to separate category file
Former-commit-id: b52ea92
1 parent b05400d commit 486a7ee

11 files changed

+177
-30
lines changed

IQKeyBoardManager/.DS_Store

2 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//
2+
// IQUITextFieldView+Additions.h
3+
// https://github.com/hackiftekhar/IQKeyboardManager
4+
// Copyright (c) 2013-15 Iftekhar Qurashi.
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in
14+
// all copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
// THE SOFTWARE.
23+
24+
#import <UIKit/UIKit.h>
25+
26+
/**
27+
UIView category for managing UITextField/UITextView
28+
*/
29+
30+
@interface UIView (Additions)
31+
32+
/**
33+
To set customized distance from keyboard for textField/textView. Can't be less than zero
34+
*/
35+
@property(nonatomic, assign) CGFloat keyboardDistanceFromTextField;
36+
37+
@end
38+
39+
///-------------------------------------------
40+
/// @name Custom KeyboardDistanceFromTextField
41+
///-------------------------------------------
42+
43+
/**
44+
Uses default keyboard distance for textField.
45+
*/
46+
extern CGFloat const kIQUseDefaultKeyboardDistance;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
//
2+
// IQUITextFieldView+Additions.m
3+
// https://github.com/hackiftekhar/IQKeyboardManager
4+
// Copyright (c) 2013-15 Iftekhar Qurashi.
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in
14+
// all copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
// THE SOFTWARE.
23+
24+
#import "IQUITextFieldView+Additions.h"
25+
#import <objc/runtime.h>
26+
27+
@implementation UIView (Additions)
28+
29+
-(void)setKeyboardDistanceFromTextField:(CGFloat)keyboardDistanceFromTextField
30+
{
31+
//Can't be less than zero. Minimum is zero.
32+
keyboardDistanceFromTextField = MAX(keyboardDistanceFromTextField, 0);
33+
34+
objc_setAssociatedObject(self, @selector(keyboardDistanceFromTextField), [NSNumber numberWithFloat:keyboardDistanceFromTextField], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
35+
}
36+
37+
-(CGFloat)keyboardDistanceFromTextField
38+
{
39+
NSNumber *keyboardDistanceFromTextField = objc_getAssociatedObject(self, @selector(keyboardDistanceFromTextField));
40+
41+
return (keyboardDistanceFromTextField)?[keyboardDistanceFromTextField floatValue]:kIQUseDefaultKeyboardDistance;
42+
}
43+
44+
@end
45+
46+
///------------------------------------
47+
/// @name keyboardDistanceFromTextField
48+
///------------------------------------
49+
50+
/**
51+
Uses default keyboard distance for textField.
52+
*/
53+
CGFloat const kIQUseDefaultKeyboardDistance = CGFLOAT_MAX;
54+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// IQUIViewController+Additions.h
3+
// https://github.com/hackiftekhar/IQKeyboardManager
4+
// Copyright (c) 2013-15 Iftekhar Qurashi.
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in
14+
// all copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
// THE SOFTWARE.
23+
24+
#import <UIKit/UIKit.h>
25+
26+
@interface UIViewController (Additions)
27+
28+
/**
29+
Top/Bottom Layout constraint which help library to manage keyboardTextField distance
30+
*/
31+
@property(nonatomic, strong) IBOutlet NSLayoutConstraint *IQLayoutGuideConstraint;
32+
33+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//
2+
// IQUIViewController+Additions.m
3+
// https://github.com/hackiftekhar/IQKeyboardManager
4+
// Copyright (c) 2013-15 Iftekhar Qurashi.
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in
14+
// all copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
// THE SOFTWARE.
23+
24+
#import "IQUIViewController+Additions.h"
25+
#import <objc/runtime.h>
26+
27+
@implementation UIViewController (Additions)
28+
29+
-(void)setIQLayoutGuideConstraint:(NSLayoutConstraint *)IQLayoutGuideConstraint
30+
{
31+
objc_setAssociatedObject(self, @selector(IQLayoutGuideConstraint), IQLayoutGuideConstraint, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
32+
}
33+
34+
-(NSLayoutConstraint *)IQLayoutGuideConstraint
35+
{
36+
return objc_getAssociatedObject(self, @selector(IQLayoutGuideConstraint));
37+
}
38+
39+
@end

IQKeyBoardManager/IQKeyboardManager.h

-28
Original file line numberDiff line numberDiff line change
@@ -295,31 +295,3 @@ extern NSInteger const kIQPreviousNextButtonToolbarTag;
295295

296296
@end
297297

298-
299-
300-
///-------------------------------------------
301-
/// @name Custom KeyboardDistanceFromTextField
302-
///-------------------------------------------
303-
304-
/**
305-
Uses default keyboard distance for textField.
306-
*/
307-
extern CGFloat const kIQUseDefaultKeyboardDistance;
308-
309-
/**
310-
UIView category for IQKeyboardManager
311-
*/
312-
@interface UIView (IQKeyboardManagerAdditions)
313-
314-
/**
315-
To set customized distance from keyboard for textField/textView. Can't be less than zero
316-
*/
317-
//#if TARGET_INTERFACE_BUILDER
318-
//@property(nonatomic, assign) IBInspectable CGFloat keyboardDistanceFromTextField;
319-
//#else
320-
@property(nonatomic, assign) CGFloat keyboardDistanceFromTextField;
321-
//#endif
322-
323-
@end
324-
325-
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
75c7be7ceb12526c9e315a339aa857e977ea869a
1+
54f99e0a0602d71225a6fb3526d0af9800d1149d
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f6bc932d93abc06c16249b9d1b1716d2ffc4ae0b
1+
b8edd0e70f7d567c565d1d277920d03cbad35469
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0648cc43c0204888d34815fb71a37289b7c0ebd6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0065327ad4c2872c16127587c6395fbbd75bca17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ae7288e6f66b0d78d2fc7fa4b158822db4956ba2

0 commit comments

Comments
 (0)