UIPicker didSelectRow Strange Behavior - iphone

I have a 3 component dependent picker and I had it working fine until I noticed a strange behavior. If I spin component 1 and then click down with mounse on Conmponent 2, then wait for Component 1 to stop spinning then let the mouse button up, all without moving the mouse or picker wheel at all... didSelectRow does not get called at all!!! Has anyone else seen this behavior and found a work around???
Thanks

Users will use fingers and not mouse :)
You should prefer testing these kinda things on device..
Have you already seen What happens on the device?

It looks like
pickerView:didSelectRow:inComponent:
only gets called once regardless of how many components there are. Seems missleading to me but if you're spinning more than one component, you'll have to cycle through them, calling
pickerView selectedRowInComponent:
for each, regardless of which component gets passed to the method.

Related

iOS Swift - How many UILongPressGestureRecognizers can be enabled at one time?

I have a simple synthesizer application that has 28 buttons (UIView's), and each one has a UILongPressGestureRecognizer attached to it. The .minimumPressDuration for each recognizer is set to 0, so that simply touching a button will begin it's UILongPressGestureRecognizer and start an AudioKit Oscillator.
All works fine until more than five buttons (recognizers) are touched (enabled) at one time. The sixth recognizer is never enabled, and the first five recognizers stay enabled, even when the user's finger lifts from any or all of the buttons.
It's an unfortunate problem, given that I would like the user to be able to play more than five notes at a time.
Any ideas?
I have attached UILongPressRecognizers to buttons that do not start an AudioKit Oscillator, but instead temporarily change the color of another view, but the problem persists.
I have also tried touching other areas of the screen that do not have UIGestureRecognizers attached to them, and even those touches seem to cause the problem.
There is an undocumented 5 touch limit on iPhone. The number is higher for iPad but I'm not sure what that limit is (greater than 10).

libgdx next screen remembers touch input from previous screen

In my game after clicking on play button from splash screen.
i am switching to game screen.
In game screen I have update method which is updating the positions of my actors depending upon screen touch..
so here I have checked
if ( Gdx.input.justTouched() ) {....}
its giving me true even i am not touching to screen..
may be it is remembering the last touch from splash screen...
Or may be the different reason that i am not getting ..
..
thanks.
The documentation of justTouched() http://libgdx.l33tlabs.org/docs/api/com/badlogic/gdx/Input.html#justTouched() doesn't really tell us what "just" means. Might be the touch from the splash screen.
Use isTouched() instead which should not have that problem.
Furthermore I think it's smarter to implement InputProcessor http://libgdx.l33tlabs.org/docs/api/com/badlogic/gdx/InputProcessor.html so you can handle the events right when they occur, and you don't need to check every frame.

How Can You Stop iOS PinchGesture from Selecting Buttons?

I'm currently writing an iOS application for the iPhone with one particular feature that creates a flowchart on the fly. The flowchart that is created is one enormous, scrollable view. Each information node of the flowchart contains buttons that automatically moves the view to the next information node. At any point in time, a user can use a pinch gesture to zoom out of the current information node and see the flowchart in its entirety.
My problem is this: I notice that if a user begins this pinch motion with one of their fingers tapping one of the buttons in an information node then this gesture takes precedence and the next node is shown as opposed the pinch gesture zooming out from the current node.
I've been looking on StackOverflow and have tried several things to fix this, but nothing yet has seemed to work. I was wondering if anyone has had similar issues and if they were able to overcome the issue?
Using #Till's advice and looking into my issue a bit more, I've done something that's worked for me and I thought I would share it here in case anyone else had similar issues or desires.
I was able to create UIViews that I could use to act as semi-buttons. For each of these views, I greated UITapGestureRecognizers and targeted them towards methods that would check to see if the sender's state is StateEnded:
-(void)handleButtonTap:(UITapGestureRecognizer *)sender
{
if(sender.state == UIGestureRecognizerStateEnded)
// Go on and do the code here
}
However, wanting to still maintain the look of the original iOS Buttons I did one step further. For each UIButton that I created, I did not associate a target with these buttons and instead created UIViews for each button. These UIViews were completely blank with a background color of "Clear." In this manner, I can now have my buttons, but still get the functionality I desired.
I hope this helps anyone else with similar issues. Thanks again to #Till for the advice.

Delegate Method only Firing after 5 or so Button Presses?

I'm having the most bizarre problem which I'm not even close to figuring out. I have a button which fires a delegate method. Once upon a time it was working fine, but after making some changes to my code, now the delegate method only fires after I push the button x amount of times (the changes I made to the code had nothing to do with the infrastructure that connects the delegate together). It varies, it can be 5 times to 10 times. I used the analyzer to check for memory leaks and there aren't any.
There is too much code for me to paste here (I don't even know where to start or where the problem could be), but I'm wondering if anyone has experienced this problem before, or what could be causing it? This is very odd and have no clue what could be causing it.
sounds like some other view is getting the touch events over the button. I've also seen this type of behavior when the touch area is too small (either because the button is too small or because it's getting clipped by another view)

Iphone default behaviors that need to be implemented?

When I've learned that I have to write some code to make the iphone keyboard go away. I was quite surprised. I was surprised even more when it become apperent that it is just the top of the iceberg.
What are the expected UI behaviors that aren't provided by system OOTB?
Is the list below complete?
The expected UI behaviors:
Focusing next text field when [done] is hit
Hiding the keyboard when background is hit
Using Touch Up Inside to fire a button action. (To give user opportunity to change his/her mind)
Supporting the screen rotation.
Some of that is silly, but some of it has uses as well.
Focusing next text field when [done] is hit
Which field is "next"? If you have a large form with fields both next to and above/below each other, next might not be so obvious. Even if they are in some linear layout, the iPhone would have to work to figure out which one is next. Do you want to wrap around at the end of the form, or dismiss the keyboard, or submit the form?
Hiding the keyboard when background is hit
I mostly agree with you here, though there are a few cases where this is useless. For example, adding a new phone number in the contact app.
Using Touch Up Inside to fire a button action
This one I really don't get. I can only guess that it's designed to allow you to use buttons instead of the touchesBegan/Moved/Ended methods. I guess it could be useful, but I've never used anything but Touch Up Inside.
Supporting the screen rotation
Many apps just don't work in any other orientation, such as games. If you want to use rotation, you only have to add two lines of code assuming you've done your layout well.
I hope this helps explain some of the strangeness. Aside from the keyboard dismissal, I've never really found anything too annoying. The one thing I wish they supported was using the highlight state of UIButtons for the set state. It would be a quick and easy toggle button, but I've taken to screenshotting a highlighted button and using that for the background image of a selected button.
Want a rounded rectangular button that isn't white? Since that one uses a background image, you can't just click something somewhere that makes it the color of your choice. You have to create your own image or you could even use CSS (WTF!?) to do it.
Unfortunately, the iPhone SDK lacks a lot of helpful things one would think would just be there. However, many people have taken the time to write wrappers for many of these kinds of things to help facilitate development - a quick google search into the functionality you are expecting may turn up a lot of useful answers!
For example, you could make the keyboard go away when you tap outside of it by creating a new view when it appears, and placing that view behind any user-interactable views on the screen. When that new view is tapped, it will become first responder and cause the keyboard to slide away (because the UITextField is no longer first responder).
Such a thing could be easily implemented as a drop-in fix for pretty much anything you'd need it for with very little code.
Still should have been included in the SDK in the first place, though!