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;








1















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.










share|improve this question


























  • self.view.endEditing(true) to simply hide keyboard

    – NavinBagul
    Mar 28 at 11:27

















1















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.










share|improve this question


























  • self.view.endEditing(true) to simply hide keyboard

    – NavinBagul
    Mar 28 at 11:27













1












1








1








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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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

















  • 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












3 Answers
3






active

oldest

votes


















1
















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.






share|improve this answer


































    1
















    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)






    share|improve this answer
































      0
















      try below code hope it works for you



      override func viewDidDisappear(animated: Bool) 
      NSNotificationCenter.defaultCenter().removeObserver(self)






      share|improve this answer



























        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
        );



        );














        draft saved

        draft discarded
















        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









        1
















        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.






        share|improve this answer































          1
















          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.






          share|improve this answer





























            1














            1










            1









            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.






            share|improve this answer















            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.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            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


























                1
















                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)






                share|improve this answer





























                  1
















                  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)






                  share|improve this answer



























                    1














                    1










                    1









                    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)






                    share|improve this answer













                    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)







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 28 at 11:30









                    chirag shahchirag shah

                    2,07517 silver badges44 bronze badges




                    2,07517 silver badges44 bronze badges
























                        0
















                        try below code hope it works for you



                        override func viewDidDisappear(animated: Bool) 
                        NSNotificationCenter.defaultCenter().removeObserver(self)






                        share|improve this answer





























                          0
















                          try below code hope it works for you



                          override func viewDidDisappear(animated: Bool) 
                          NSNotificationCenter.defaultCenter().removeObserver(self)






                          share|improve this answer



























                            0














                            0










                            0









                            try below code hope it works for you



                            override func viewDidDisappear(animated: Bool) 
                            NSNotificationCenter.defaultCenter().removeObserver(self)






                            share|improve this answer













                            try below code hope it works for you



                            override func viewDidDisappear(animated: Bool) 
                            NSNotificationCenter.defaultCenter().removeObserver(self)







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Mar 28 at 12:36









                            vijay kaharvijay kahar

                            2379 bronze badges




                            2379 bronze badges































                                draft saved

                                draft discarded















































                                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.




                                draft saved


                                draft discarded














                                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





















































                                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







                                Popular posts from this blog

                                Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                                Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                                Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript