I have encountered a problem that is my search bar doesn't hide when I tap back navigation button.
In fact, isMovingFromViewController doesn't respond when search bar is active.
I would like to know when back button is tapped so that I could make the search bar inactive and hide the keyboard.
Have you ever seen this error before?
If so, please let me know how to fix it.
Thank you
Some code would have been helpful, anyway to hide a view after a click add add a function to the button then call viewName.isHidden. but i cant suggest more until i see a code or at least a screen
Related
I need to change the text and action of the navigation item, currently, I am doing it by providing the bar button items. But my problem is when I click it, it shows click only on the item I clicked not all the items I have added to leftBarButtonItems.
I tried using a custom view(UIBarButtonItem(customView: UIButton())). But It becomes smaller and I was not able to resize it. Please see the below image to understand the problem I am having. This is the situation after clicking on the back button. Thanks for your time.
please use custom navigation bar
https://www.youtube.com/watch?v=zS-CCd4xmRY
I hope this is helpful for you
I have this project, where a modal pops up, to filter search results - the UISearchController is visible in my navigation bar when the modal pops up. I can't remove it, as it will look weird, as the modal doesn't fill the whole screen. The problem is, that the UISearchController is still active when the modal pops up, and if I tap it, it all goes crazy - so I want to disable the input field, but I really can't find out how to :/
So does anyone know, how to disable the input field in the UISearchController?
Best regards :-)
self.searchDisplayController.searchBar.userInteractionEnabled = false
For some reason I'm adding left and right buttons to the navigation bar as its subview instead of using navigation item. When pushing a view controller, I'm setting its navigationItem.hidesBackButton to YES so that the ugly looking blue 'back' button will not show up. The problem I'm facing is that, after tapping my own back button, while the currently showing view controller being popped --- I mean during the animation of the 'pop', I can see a '...' in the navigation bar moving right along with the popped view controller. And, I DON'T want that '...' to appear for even 0.0000000001 second. What may I do now? Any hint would be appreciated.
Note:Problem solved with just comment. But posting this as answer so that It will help someone else having same issue.
I too had same problem with navigationBarButtonItem while adding custom barButtonItem to navigationBar in storyboard. If you are also using storyboard then just set navigationBar tint color as clear color in navigationController. By setting clear color, that weird default navigation back button will not appear anymore.
I would like to know how I can add a back button to my UINavigationBar, I know that If I embed in a Navigation Controller in my main view, that all of this would happen automatically, but that is not what I am trying to do, in fact, the back button could go to any other view I connect the segue to, doesn't even have to be the back.
The back button needs to be the system navigation "back" button, I don't want to have to set image files for my buttons.
I tried dragging in a bar button item in storyboard but nothing shows up, doesn't seem to be doing the trick. The navigation bar was dragged to the view in storyboard (not created programmatically) and it shows up just fine.
I looked at the following similarly asked questions:
-> How do i add a 'back' button to a UINavigationBar manually?
-> How to add a button to UINavigationBar?
-> How to programmatically add a UINavigationBar and a back button on it
but they all point to just embedding the view in a navigation controller, which again, is not what I am trying to do.
If someone can please help me out, provide some sample code I would greatly appreciate it.
Try drag-drop a UIButton object. I have always added manual back button (hardly took the in-built one)
I have a navigation controller, in its navigation bar i've 2 right bar button items, I want to disable one right bar button when the other is being clicked/tapped. How to achieve this??
Thanks in advance.
Unfortunately UIBarButtonItems only have one callback and that's the equivalent of UIButton's UIControlEventTouchUpInside.
If you want to do something when the user presses and releases a button (disable/re-enable other buttons) you might have to get your hands dirty with some custom UIBarButtonItems that have UIButton's as customView and do some careful event handling to know when to enable/disable each.
On a personal note: pressing more than one bar button at the same time is not very common and shouldn't present a problem, whatever implementation you may have.