Custom Button as a Navigation Button - ios

I have a custom button like facebook app does. When I click on custom button while editing my textview, it shows left menu but doesn't hide keyboard.
I have tried everything but still my problem is there. How I can hide keyboard on clicking on custom button.

Just include this in the burger's button IBAction
[self.view endEditing:YES];

Related

How to track "Hide keyboard" button on iPad in searchBar?

I have searchBar and tableView. I have a bug, when user clicks on "hide keyboard". I have tried to user Notification Center for hiding keyboard. But it also works for "cancel" button. Maybe there is a way to exclude determining "cancel button"?
On hide keyboard button click listener you can use two from the below options
1) self.view.endEditing(true)
This will notify your current active view to stop editing which will
automatically hides the keyboard
2) yourTextField.resignFirstResponder
This will stop focusing your current editing textView which will
automatically hide the keyboard.
As you will write this code specific to your Hide keyboard button it won't apply the same solution to your Cancel button.

Add button to keyboard toolbar

I have UIWebView integrated in my app. When I'm clicking on text fields inside it keyboard with 3 toolbar button called (<, > and Done).
Is it any way so add custom buttons to that toolbar?
you can create a custom UIView to instead the inputAccessoryView. After that, add your custom buttons on the custom UIView。

iOS can I programmatically present UITableViewRowAction, or have it stay visible?

I have a side swipe menu implemented for a UITableView using UITableViewRowAction. I would like to add a "Done" button to this menu and have it visible while the user is editing a cell. Once "Done" is pressed, the action would complete normally.
Can I programmatically present UITableViewRowAction for a specific table view row?
or
Can I have UITableViewRowAction stay visible after user taps one of its buttons?

Whenever i click just outside any button(which is UISegmentedControl button) also, the button gets clicked. Can anyone tell me why is this happening?

In my project, i am having a problem with clicking of the button which i have set as segmentedControl. When tapped just outside the button also, the button gets clicked. Can anyone give a solution to this?
If the button is inside a navigation bar, then the behavior is normal as far as I can tell. I've noticed the same behavior with regular bar button items. Drag and drop a bar button item into a navigation bar, run the app in the simulator. You'll notice that your mouse cursor can be just outside the button boundary and still activate the button. So what's going on? I think the system (the navigation bar) it just trying to predict what our fat hominid fingers are trying to touch.
Probably you have bind (programmatically or via IB) your action to wrong button's
UIControlEvents
value. It should be
UIControlEventTouchUpInside
If you have created UIButoon programmatically check that you have
[button addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];

Replace left navigation button with custom button, then back

I have a UITableView within an UINavigationController. On the right of the UINavigationBar I have an "Edit" button. When I tap this button, all the textfields in the table cells become activated so I can edit them. The right button changes to "Save".
I'd now like the left "back" button of the UINavigationController to be replaced by a "Cancel" button which when I tap doesn't bring me back to the previous UIViewController, but just cancels editing mode.
When I tap "Save" the "Cancel" button should be changed back to the usual UINavigationController back button. Is there any easy way to do this? I tried accessing [[self navigationItem] leftBarButtonItem]. This works for the right button, but not the left one.
Set the leftBarButtonItem to your Cancel button. At the appropriate time, set the leftBarButtonItem to nil to remove your Cancel button. This will automatically restore the original back button that was in place before you added the Cancel button.
It sounds like the leftBarButtonItem is a "BackButton", which is set on the UIView(Controller) you used to navigate to the current View.
You can hide the BackButton following the answer in this question. This should be done, since you cannot change it's behavior.
I believe you are then able to use the leftBarButtonItem.
See this other SO question.
Then make sure you declare the cancel method similar to this.
(void)cancel:(id)sender {
[self.navigationController popViewControllerAnimated:YES];
}

Resources