ATWindow
public class ATWindow: UIWindow
The ATWindow adds various functionalities to UIWindow, e.g. dismiss keyboard on tap on screen, adjust text-field frame as per keyboard visible/hidden.
-
The variable allows to dismiss the keyboard on tapping anywhere outside the editable controls (UITextField, UITextView etc.).
Usage Example
(UIApplication.shared.keyWindow as! ATWindow).shouldDismissKeyboardOnTap = true
- You can write above line of code in
application:didFinishLaunchingWithOptions:
,viewDidLoad
or any other suitable method.Make sure application keyWindow is initialized as ATWindow.
See also
addDismissKeyboardExemptedRestorationId(_ pRestorationId :String)
removeDismissKeyboardExemptedRestorationId(_ pRestorationId :String)
Declaration
Swift
public var shouldDismissKeyboardOnTap :Bool = false
- You can write above line of code in
-
The variable allows to adjust window pan according to keyboard, i.e. when keyboard comes up, the application page will move up to make editable control (UITextField, UITextView etc.) visible.
Usage Example
(UIApplication.shared.keyWindow as! ATWindow).shouldAdjustPanForKeyboard = true
- You can write above line of code in
application:didFinishLaunchingWithOptions:
,viewDidLoad
or any other suitable method.Make sure application keyWindow is initialized as ATWindow.
See also
addAdjustPanExemptedRestorationId(_ pRestorationId :String)
removeAdjustPanExemptedRestorationId(_ pRestorationId :String)
Declaration
Swift
public var shouldAdjustPanForKeyboard :Bool = false
- You can write above line of code in
-
Initializer.
Declaration
Swift
required public init(coder pDecoder: NSCoder)
-
Initializer.
Declaration
Swift
override public init(frame:CGRect)
-
Overridden method from superclass.
Declaration
Swift
override public func awakeFromNib()
-
The function allows to exempt view from dismissing keyboard on tap on it.
If you want that the keyboard should not be dismissed on tap on a specific view, then add its restoration ID using this method. You can set restoration ID for any view in nib, storyboard or via code.
Usage Example
(UIApplication.shared.keyWindow as! ATWindow).addDismissKeyboardExemptedRestorationId("firstNameContainerViewResId")
- You can write above line of code in
application:didFinishLaunchingWithOptions:
,viewDidLoad
or any other suitable method.Make sure application keyWindow is initialized as ATWindow.
Precondition
shouldDismissKeyboardOnTap
of ATWindow should be set as true.See also
removeDismissKeyboardExemptedRestorationId(_ pRestorationId :String)
shouldDismissKeyboardOnTap
Declaration
Swift
public func addDismissKeyboardExemptedRestorationId(_ pRestorationId :String)
Parameters
pRestorationId
Restoration ID of a view that is to be exempted from dismissing the keyboard.
- You can write above line of code in
-
The function allows to remove the exempted views from dismissing keyboard on tap on it.
If you have added a view to exempt keyboard dismissing, but now you dont want to exempt that view, then you can remove it using this method.
Usage Example
(UIApplication.shared.keyWindow as! ATWindow).removeDismissKeyboardExemptedRestorationId("firstNameContainerViewResId")
- You can write above line of code in
application:didFinishLaunchingWithOptions:
,viewDidLoad
or any other suitable method.Make sure application keyWindow is initialized as ATWindow.
Precondition
shouldDismissKeyboardOnTap
of ATWindow should be set as true.See also
addDismissKeyboardExemptedRestorationId(_ pRestorationId :String)
shouldDismissKeyboardOnTap
Declaration
Swift
public func removeDismissKeyboardExemptedRestorationId(_ pRestorationId :String)
Parameters
pRestorationId
Restoration ID of a view that is to be removed from exemption.
- You can write above line of code in
-
The function allows to exempt editable controls from adjusting pan according to keyboard.
If you want that the window pan should not be adjusted according to keyboard for any specific editable control (UITextField, UITextView etc.), then add its restoration ID using this method. You can set restoration ID for any view in nib, storyboard or via code.
Usage Example
(UIApplication.shared.keyWindow as! ATWindow).addAdjustPanExemptedRestorationId("firstNameTextFieldResId")
- You can write above line of code in
application:didFinishLaunchingWithOptions:
,viewDidLoad
or any other suitable method.Make sure application keyWindow is initialized as ATWindow.
Precondition
shouldAdjustPanForKeyboard
of ATWindow should be set as true.See also
removeAdjustPanExemptedRestorationId(_ pRestorationId :String)
shouldAdjustPanForKeyboard
Declaration
Swift
public func addAdjustPanExemptedRestorationId(_ pRestorationId :String)
Parameters
pRestorationId
Restoration ID of an editable control that is to be exempted from pan adjustment according to keyboard.
- You can write above line of code in
-
The function allows to remove the exempted editable controls from adjusting pan according to keyboard.
If you have added an editable control to exempt window pan adjustment, but now you dont want to exempt that control, then you can remove it using this method.
Usage Example
(UIApplication.shared.keyWindow as! ATWindow).removeAdjustPanExemptedRestorationId("firstNameTextFieldResId")
- You can write above line of code in
application:didFinishLaunchingWithOptions:
,viewDidLoad
or any other suitable method.Make sure application keyWindow is initialized as ATWindow.
Precondition
shouldAdjustPanForKeyboard
of ATWindow should be set as true.See also
addAdjustPanExemptedRestorationId(_ pRestorationId :String)
shouldAdjustPanForKeyboard
Declaration
Swift
public func removeAdjustPanExemptedRestorationId(_ pRestorationId :String)
Parameters
pRestorationId
Restoration ID of an editable control that is to be removed from exemption.
- You can write above line of code in