Custom bar button item not detecting touch correctly - ios

I have created two custom buttons in the nav bar's right bar button using storyboard like so:
Below is how they look. I've added background colours to the buttons for easy viewing of detectable area.
The problem I am having is that the map button on the right is only detecting touch events on the left side of the button. The left button is detecting touch events fine. What's even stranger is that it seems to work fine in the simulator, but not on devices. I've tried on multiple devices and they all have the same issue. This is driving me crazy.... been at it all day. Please help!

After banging my head against the wall for two days with this one, I finally realised that as of Xcode 7 you can finally just drag multiple UIBarButtonItems to the UINavigationItem directly in Interface Builder. Creating the two buttons this way instead of the previous method fixed the issue.

Related

Make buttons behind NavBar clickable

So I'm working on a project where we are doing a custom header which collapses/expands as the user drags either the header or a scrollview/tableview.
In some cases we want to have buttons in the header that will end up where the navbar is in a collapsed state, which gets animated in a nice way to there.
So the problem is when the button gets behind the navbar (a transparent one) its not clickable anymore.
We tried altering the Z layer for the button and the "bringSubviewToFront" but none works.
We also tried to alter the height of the navbar according to this link but it seems as well its not working anymore. Also, just hiding the navbar would not be a passable solution as we sometimes will need the back button there as well.
screenshot
So if anyone have any good answer or workaround for this issue, it would be greatly appreciated.
We are using the answer in the appDelegate from this question to make the navbar transparent.
Look into using Hit Test, it should be able to do what you need:
https://developer.apple.com/documentation/uikit/uiview/1622469-hittest

Ios menu related issue

Since I'm new to Ios , What i wanted to is given demonstration bellow
That means, on over the image and some text will remain static but , bellow a sliding menu would work like the gif.
if I tap on some menu item it will slide to bring related menu. if I press on the cross it will act back ward.
I don't even know what does it call. I tried with customsegue and transitions. but no luck . also tried with transparent show modally. it works for one view but not for backword (i.e. unwinding) . it get darker.
You can try using UIPageController for pagination effect.

iOS UISlider not moving when I swipe, even though other UI elements are fine

I've created a simple xib file with three buttons and a UISlider.
When I start the app on my phone I'm able to tap the buttons no problem, but the UISlider is locked and doesn't move..
However if I keep trying to move it with my finger it eventually scrolls left and right fine, but only after about a minute of furious screen swiping..
I thought it might be because it was hidden behind something onscreen (not that there's anything for it to hide behind) so I did 'arrange -> send to front', but this doesn't help.
Does anyone know why it might be doing this?

UIBarButtonItem triggers action only when pressed for long enough

I have a few simple UIBarButtonsItems(no customization other than changing style, color and alpha). Everything was working perfectly fine for some time. But now I need to press BarButton for a long time(4-5 seconds) before the action is triggered. I just moved toolbar around and changed color and alpha after which this started happening. I don't exactly understand what caused this change of behavior.
I used interface builder to build the view and assigned action to UIBarButtonItems by Ctrl+Dragging.
I tried looking up a lot both on google and so. Most of the questions are about UIBarButtons not responding at all. Still I tried the solution of cleaning build of project and Xcode cache. But nothing changed.
Could someone help me with this?
I realized my mistake. I had two events getting triggered in same space in view. First was to reveal toolbar(i.e. increase its alpha) when tapped in particular area of the view and second one was of course button tap event for UIBarButtonItem. When tapped in that area the first event got triggered and eventually when pressed for long it also fired the second event once the toolbar was visible(if toolbar was invisible before).
Sorry to bother you all.

Editing toolbar in Xcode 4.6 - unable to add Bar Button Items

I am attempting to add a toolbar as an input accessory, and as such have added it via xcode storyboard editor to the view controller (and not within the view). This was as specified in this tutorial(which seems to be written for an earlier version of xcode): reference
My issue: "8.) Now we need to open the toolbar item itself. Double click Toolbar in the document window."
This is no longer valid behavior in Xcode 4.6 it appears, so I ask you: how do I add button items to a toolbar? I would prefer to avoid doing it programmatically (Still reasonably new to xcode development and normally make my GUIs with storyboards) but if I have to, I have to.
Many thanks!
If you're doing what I think you are doing, adding UIBarButtonItems to a UIToolbar, then you simply drag a Bar Button Item out to the toolbar.
However, I would assume that what they mean when they say 'double-click' is not what people normally think of when they think double click. Try double clicking slowly this often does the trick.
Found the issue - it was appearing behind the UIView. However you dont ever need to graphically interact witha toolbar, you can just drag-and-drop controls onto it in the sidebar. If there is a need for more info on this message me or vote up.

Resources