UIButton and UISlider in tap conflict - ios

I have a strange problem. The designers provided me with a design (no change possible) that puts a button quite near a slider.
For the sake of explanation, let's talk about left side.
The button only registers the tap from approx. two thirds of its width from the left. If I tap further to the right, the tap is registered in the slider.`
Even if I change the Z order of those controls in IB, it still happens.
Why and what would be the solution to make the whole area of the button register the tap for itself?

You should respect the Apple HCI guidelines, they are there for a reason. Have a word with the designers ;-j

Related

VoiceOver, but not Speak Screen talking on iOS 9

I have a page on an iOS app, that really consists of a series of custom buttons. The buttons are in a view hierarchy that consists of two labels and an image view behind them.
For accessibility support, I have made the two labels hidden to the accessibility system, to prevent accessibility focus from going onto each of the labels rather than the parent button. Accordingly, I have made the contents of one of these labels the accessibility label of the button, and the other the button's accessibility hint. This works well in VoiceOver, focus is moving between the buttons, with explanations of what they are and what they do.
Now when I use Speak Screen, I end with up a result of "No speakable content could be found on the screen." I expected it to speak the contents of the screen. Part of this is because I have set the labels to be hidden to accessibility, but this should be compensated for by speaking accessibility labels of the buttons.
Looking over some other apps and quick tests I have been doing, I am frequently seeing that Speak Screen seems to skip over buttons. I could give my buttons the accessibility trait of 'Static Text' in addition to button, but this seems like a misuse of the traits.
Is it the intended behaviour of Speak Screen to skip buttons or other controls? Is there a way to prevent the individual labels from gaining accessibility focus, while still being visible to Speak Screen?
As per my earlier comment, I am listening for the UIAccessibilitySpeakScreenStatusDidChangeNotification and checking Speak Screen's status with UIAccessibilityIsSpeakScreenEnabled. If Speak Screen is enabled, I am changing the labels to be shown or hidden to accessibility accordingly.

iCarousel – Make all items selectable, not just centered one

I'm using the great iOS control iCarousel's Wheel type and I want all of the buttons it contains to be usable / selectable at any time (i.e. I can tap any of them, no matter which one is currently at the top of the wheel). The user can still scroll the wheel as normal, but no matter which button they tap, it should register.
The current behavior seems inconsistent: if I tap one of the buttons directly next to the center one (to its left or right), that button moves into the center slot. Clicking one of the buttons two positions away 'sometimes' causes it to scroll to that letter, sometimes it's ignored. Any other buttons are always ignored.
Is this possible to set up, preferably without hugely modifying the class? I'm by no means an expert, but am learning every day :)
Thanks in advance.
Set carousel.centerItemWhenSelected = NO;
That will disable the behaviour where buttons other than the centre one are scrolled to the centre when you tap them.
As for the reason why some are not responding to taps at all, it is most likely because the frame of your carousel view is too small and the tap events are outside of the frame.
If you set carousel.clipsToBounds = YES; it will crop the carousel views to the frame as well so you'll be able to see exactly what size your carousel actually is.

UIButton and UITextField unclickable due to UIScrollView placement?

I've began iOS development recently and have created a basic layout using Interface Builder. However, I've noticed that my UIScrollView is causing my UITextField and UIButton to be unclickable (up to a certain point).
Here is a screenshot. Everything above the red line is clickable and responds to touch events, but everything below is/does not.
I decided to move my UIScrollView down a few pixels, and noticed this "red line" moved down as well. After shrinking the height of the UIScrollView from 589px to 550px, I am now able to click anywhere on the button/in the text field (since the theoretical "red line" is now just below the button). Here is that screenshot:
So, my question is, why was the UIScrollView doing this to my UITextField and UIButton? It seems as though it was overlapping the text field and button somehow, despite it appearing to be physically below them. Is there any way to avoid this "overlap" without having to sacrifice those 39 pixels I gave up to prevent the "overlap"?
Write this code in viewDidLoad function
[self.view sendSubviewToBack:scrolView];
Hope this helps you..

UIPopOver, UITextView and automatic resizing

I've got an app where I allow the user to add events to a list. The method I use to do this is via a form that I show the user in a UIPopOver.
The form has the following components (in this order, top to bottom):
Event Description Label (UILabel)
Event Description (UITextField)
Event Details Label (UILabel)
Event Details (UITextView)
Event Time Label (UILabel)
Event Time (UIDatePicker)
Save Event (Custom Button)
Cancel (Custom Button)
I'd prefer not to show a screen shot since it's a sensitive app. :-)
So........
All is well when I first show the UIPopOver. Everything appears as I wish. The overall layout is about 650 pixels tall, which is just tall enough to take up pretty much the whole screen (vertically) when in landscape mode.
When the user tries to interact with the `UIDatePicker`, everything goes swimmingly (well).
When the user taps into the Event Description (`UITextField`) field, the keyboard appears and the `UIPopOver` shrinks so that basically the `UIDatePicker` and buttons are hidden. I consider this OK, since they re-appear when the keyboard is dismissed.
The problem I am having is when the user tries to interact with the `UITextView`:
When the view of the `UIPopOver` has its `backgroundColor` property set to `[UIColor whiteColor]`, the `UITextView` initially appears with a thin black border. I like this.
When the user taps in the `UITextView` to begin editing, the `UIPopOver` resizes to accommodate the keyboard and, during the transition, the black border "shrinks up" and disappears. This is in spite of my shocks and struts being set so that all dimensions/directions are fixed and it is "glued" to the top-left.
Following this, when the user dismisses the keyboard, the border sort of restores itself to its previous position, but it now adds a thick black border on the bottom that completely obscures the label placed between the `UITextView` and the `UIDatePicker`.
When I change the background of the view of the `UIPopOver` to "`ScrollView` Textured Background Color", the border "disappearing trick" is at least less noticeable, but the black border at the bottom (following keyboard dismissal) is still present.
Questions
Has anyone encountered something like this before?
Does anyone think it's just an IB error and that I need to re-build my XIB?
Anybody got any other ideas? Googling for this issue came up fairly empty for me. If you think of better terms and find something, please let me know (gently).
Boy, I'm a stupid stupid!!! It turns out I had forgotten that I placed the UITextView inside of a UIView (inset 1 pixel on all sides) and set the background of the UIView to be black so that I could get a border effect on the UITextView. Once I remembered that, setting the shocks/struts of THAT UIView turned out to be the solution.
Sorry for wasting your time!

BarButtonItem On Toolbar

I have a toolbar at the bottom of my screen. I want to have two buttons on it, one on the left side, and one on the right. However, unlike a navigation bar, there are multiple spots that aren't on each far side of the bar, but rather they stack next to each other from the left to right.
I tried using a fixed separator, however the length doesn't stay contant (the button needs to stay on the far left while another is on the far right) as orientation and device changes. So, how would I go about keeping the buttons on each side of the toolbar no matter the orientation and device? I feel like there has to be an easier way than getting the device type and orientation and varying the length for each one.
I tried my best to explain, and I can understand if there was an issue understanding what I'm trying to say. If you need any clarification or other details, just ask!
Thanks
Jake
There are two separators, a fixed separator and a flexible separator. You used the wrong one; use the flexible separator!

Resources