Remove keyboard notification when ViewController disappearsHow do you dismiss the keyboard when editing a UITextFieldHow can I make a UITextField move up when the keyboard is present - on starting to edit?How to navigate through textfields (Next / Done Buttons)Eliminate extra separators below UITableViewAndroid: remove notification from notification barPassing Data between View ControllersperformSelector may cause a leak because its selector is unknownNSNotificationCenter addObserver in SwiftClose iOS Keyboard by touching anywhere using SwiftMove view with keyboard using Swift
Telling my mother that I have anorexia without panicking her
Sort files in a given folders and provide as a list
What is my breathable atmosphere composed of?
Make 2019 with single digits
Difference in using Lightning Component <lighting:badge/> and Normal DOM with slds <span class="slds-badge"></span>? Which is Better and Why?
Why is the Digital 0 not 0V in computer systems?
Does deswegen have another meaning than "that is why"?
What is this gigantic dish at Ben Gurion airport?
Cannot find Database Mail feature in SQL Server Express 2012 SP1
My research paper filed as a patent in China by my Chinese supervisor without me as inventor
Planar regular languages
Some Prime Peerage
What hard drive connector is this?
Is a suit against a University Dorm for changing policies on a whim likely to succeed (USA)?
Why is the T-1000 humanoid?
Why don't Wizards use wrist straps to protect against disarming charms?
Parallel resistance in electric circuits
How do I get rid of distortion in pictures of distant objects photographed with a telephoto lens?
Why did it become so much more expensive to start a university?
What was the motivation for the invention of electric pianos?
In what state are satellites left in when they are left in a graveyard orbit?
Has SHA256 been broken by Treadwell Stanton DuPont?
What's 待ってるから mean?
Mutable named tuple with default value and conditional rounding support
Remove keyboard notification when ViewController disappears
How do you dismiss the keyboard when editing a UITextFieldHow can I make a UITextField move up when the keyboard is present - on starting to edit?How to navigate through textfields (Next / Done Buttons)Eliminate extra separators below UITableViewAndroid: remove notification from notification barPassing Data between View ControllersperformSelector may cause a leak because its selector is unknownNSNotificationCenter addObserver in SwiftClose iOS Keyboard by touching anywhere using SwiftMove view with keyboard using Swift
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
How can I remove keyboard notification?
I put observer on keyboard open and close.
I change the view size depend on keyboard is open or close.
ios swift notifications uikeyboard
add a comment
|
How can I remove keyboard notification?
I put observer on keyboard open and close.
I change the view size depend on keyboard is open or close.
ios swift notifications uikeyboard
self.view.endEditing(true) to simply hide keyboard
– NavinBagul
Mar 28 at 11:27
add a comment
|
How can I remove keyboard notification?
I put observer on keyboard open and close.
I change the view size depend on keyboard is open or close.
ios swift notifications uikeyboard
How can I remove keyboard notification?
I put observer on keyboard open and close.
I change the view size depend on keyboard is open or close.
ios swift notifications uikeyboard
ios swift notifications uikeyboard
edited Mar 28 at 12:57
Onur Tuna
6646 silver badges23 bronze badges
6646 silver badges23 bronze badges
asked Mar 28 at 10:27
Vijay KaharVijay Kahar
62 bronze badges
62 bronze badges
self.view.endEditing(true) to simply hide keyboard
– NavinBagul
Mar 28 at 11:27
add a comment
|
self.view.endEditing(true) to simply hide keyboard
– NavinBagul
Mar 28 at 11:27
self.view.endEditing(true) to simply hide keyboard
– NavinBagul
Mar 28 at 11:27
self.view.endEditing(true) to simply hide keyboard
– NavinBagul
Mar 28 at 11:27
add a comment
|
3 Answers
3
active
oldest
votes
Try this to remove keyboard open show observers,
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
you should remove observers either in deinit
Or viewDidDisappear
as per your requirement.
add a comment
|
You can put the code at two place.
override func viewDidDisappear(_ animated: Bool)
super.viewDidDisappear(animated)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
And on this one
deinit
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
add a comment
|
try below code hope it works for you
override func viewDidDisappear(animated: Bool)
NSNotificationCenter.defaultCenter().removeObserver(self)
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55395298%2fremove-keyboard-notification-when-viewcontroller-disappears%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try this to remove keyboard open show observers,
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
you should remove observers either in deinit
Or viewDidDisappear
as per your requirement.
add a comment
|
Try this to remove keyboard open show observers,
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
you should remove observers either in deinit
Or viewDidDisappear
as per your requirement.
add a comment
|
Try this to remove keyboard open show observers,
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
you should remove observers either in deinit
Or viewDidDisappear
as per your requirement.
Try this to remove keyboard open show observers,
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
you should remove observers either in deinit
Or viewDidDisappear
as per your requirement.
edited Mar 28 at 11:25
answered Mar 28 at 10:47
Dhaval BhimaniDhaval Bhimani
5081 gold badge6 silver badges18 bronze badges
5081 gold badge6 silver badges18 bronze badges
add a comment
|
add a comment
|
You can put the code at two place.
override func viewDidDisappear(_ animated: Bool)
super.viewDidDisappear(animated)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
And on this one
deinit
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
add a comment
|
You can put the code at two place.
override func viewDidDisappear(_ animated: Bool)
super.viewDidDisappear(animated)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
And on this one
deinit
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
add a comment
|
You can put the code at two place.
override func viewDidDisappear(_ animated: Bool)
super.viewDidDisappear(animated)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
And on this one
deinit
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
You can put the code at two place.
override func viewDidDisappear(_ animated: Bool)
super.viewDidDisappear(animated)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
And on this one
deinit
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.UIKeyboardWillHide, object: nil)
answered Mar 28 at 11:30
chirag shahchirag shah
2,07517 silver badges44 bronze badges
2,07517 silver badges44 bronze badges
add a comment
|
add a comment
|
try below code hope it works for you
override func viewDidDisappear(animated: Bool)
NSNotificationCenter.defaultCenter().removeObserver(self)
add a comment
|
try below code hope it works for you
override func viewDidDisappear(animated: Bool)
NSNotificationCenter.defaultCenter().removeObserver(self)
add a comment
|
try below code hope it works for you
override func viewDidDisappear(animated: Bool)
NSNotificationCenter.defaultCenter().removeObserver(self)
try below code hope it works for you
override func viewDidDisappear(animated: Bool)
NSNotificationCenter.defaultCenter().removeObserver(self)
answered Mar 28 at 12:36
vijay kaharvijay kahar
2379 bronze badges
2379 bronze badges
add a comment
|
add a comment
|
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55395298%2fremove-keyboard-notification-when-viewcontroller-disappears%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
self.view.endEditing(true) to simply hide keyboard
– NavinBagul
Mar 28 at 11:27