Custom back button is tons slower than native back button - ios

Why is there a pregnant pause between custom back button touch up
and an action delivered?
back button was setup using abbood recipe here
How can I have a UIBarButtonItem with both image and text?
but it's not specific to this method of back button setup.
I remember it was always slow.

The problem is probably that when you put a custom button inside a UIBarButtonItem you have a button within a button. So the runtime has to figure out what exactly the tap belongs to and what kind of tap it is.

Related

Other buttons in my view are being pressed on button press

Something strange is happening in my app. I'm finding that when I press any button, all of the other buttons on my view are getting pressed. They all seem to be linked somehow.
There are no outlets connecting them to each other, they're not linked to the same function or anything. I can't figure out why this is happening? Any ideas why pressing one button will trigger a touchupinside event on another, unrelated button?
Thanks
I bet you created a button, added an action to it, and then duplicated it, dragged the copy to a new location, and added an action to the copy. Then you continued with that process.
Go to the "connections inspector" tab on the right (The circle with an arrow on it). Select each button. I'm guessing that you have multiple actions on each button. (A button can contain multiple actions.)

Detecting when back button is tapped in navigation bar

I need to resignFirstResponder() on a text field when the user taps the back button in the navigation bar of the navigation controller, otherwise I get some error. The back button works as it should (the previous view gets shown) but I don't know where to do resign first responder. It's too late if I do it in viewWillDisappear() (I tried), and prepareForSegue() doesn't get called, so I need to somehow do it as soon as the back button gets tapped or at least before viewWillDisappear(). How do I detect that event?
Note: See first comment on question for simpler answer
You could combine NotificationCenterand this post: Execute action when back bar button of UINavigationController is pressed to make a custom back button (that looks the same). Just post a Notification in the action for the back button, and add an observer for the Notification on the textfield whose action calls resignFirstResponder. You would also need to make an image or draw an image in CoreGraphics for the arrow.

ios9 custom action on nav back button

From my understanding in order to follow apples standard nav design there cannot be custom actions performed when the back button is pressed since the back button is no longer configured by the programer. However there are several cases where i would like to invoke some actions when the back button is pressed. For example send out network requests & setup some globals. What is a reliable means of executing code only when the back button is pressed?

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

Method for a custom back button

I am working on an iOS app for iPhone using Objective C in Xcode. I have a custom toolbar and a custom back button.
If I use
[self.na vigationController popViewControllerAnimated:YES];
Then the button does not do the back action and go back to the previous screen.
How do I navigate to the previous screen if I click the custom back button?
Make sure that you have already add selector to your button.
Then check event of the button, event should be 'touchUpInside'.
These are the most common mistakes.

Resources