iPhone UIControlEvent when touches have ended - iphone

I have a volume slider in my application that I'd like to have a sound effect play when the user changes the value. The standard valueChanged event works well here, and I'd like to use it in conjunction with a touches ended signal to trigger the sound at the end. Is there a control event here that I'm missing that would run my method when the touches finish? It doesn't seem like there is a UIControlEventTouchesEnded...

Some code samples would help, but I guess you're looking for UIControlEventTouchUpInside. I'm not sure, if it works with a slider.

One possibility would be to set the slider's continuous to NO. Now it emits just one valueChanged event, namely when the user is all finished - just what you want to know.

Related

How to receive single tap and hold Remote-Control Event with iOS?

I'm looking for my app to listen for the single tap and hold of the play/pause button on headphones for iOS devices. Currently, the behavior is to start Voice Control (on my iPhone 4).
The event list for remote control events allows for getting the double tap and hold (BeginSeekingForward) and the release (EndSeekingForward), but I'm looking for the single tap and hold which currently activates Voice Control.
Is there a way for my app to override Voice Control and listen for the single tap and hold?
You can add in a UILongPressGestureRecognizer to your UIButton and work from there.
If you want to prevent your other method from being called, you'll also need a UITapGestureRecognizer that counts taps and sets a value to true when it receives a second tap and another method (Check from your UIResponder touch* methods) for a touch release and set the value back to false.
Using that value, you can check with the UILongPressGestureRecognizer to see if the user double tapped or not.
Alternatively, you could also just have the value set to false upon a touch to the button that doesn't have a tap count of two.
Hope this helps!
EDIT: You cannot override the headphones (as far as I know) without jailbreaking the device. Normally you should never have to code for people interacting using the Apple headphones, since that would severely reduce the market and usability of your app. If someone were to forget their headphones, for example, they could not utilize your app. Its just something to think about. You don't want to limit your apps accessibility too much.

Cocos2d (iOS) + SneakyInput. The best way to handle joystick (joypad) events?

I have seen at least two ways:
1)to handle the touch screen events
2)to schedule a repeatable task which will send a joypad state to an object. The original link:
link
I have chosen the second way. But additionally I use a timer instance for repeating pressing button event.
I have also created a constants which mean all the possible joypad states (sneakyinput joypad states are represented by numbers by default)

UILocalNotification Or EventKIt

I have read the material regarding UILocalNotification , but there is no way i find to play a infinite loop sound when the notification is fired , it does play for a short time with showing an alert, but i want to achieve the goal of playing a continuos sound by providing the option of snooze and quite . I have gone through the UIEvent Kit too but unable to find a way to achieve this goal. One more question is there a way to customize the alert button action which are provided by default by the apple.
looking for you guys early response
Thanks in Advance.
I did not do that but there is a function when local notification fires this function is invoked but before it invoked the ok or view or what ever you name the button should be pressed after that you can sms code in that function and it should take care for that ...Hope This will help you

play sound while sliding finger on iphone

i like to add the function playing sounds when either sliding fingers on the surface to my iphone app. the sounds are playing now only when pushing buttons.
i suppose this works with TouchesMoved, but i don't know how to implement the "AVAudioPlayer" code to the touches event code.
please any code sample, thanks!
As far as I'm aware, TouchesMoved is used to trigger events on the screen (when 'moved over') which in turn can trigger sound events. I don't beleive there is a way you can produce a sound when the user is just 'sliding' around the screen and not interacting with any objects.
This is something I've looked into myself but didn't come up with a solution, but I'll hopefully be corrected in this thread if wrong!
You can instantiate an AVAudioPlayer inside of the touchesMoved:withEvent: method and play a sound. You need to keep a strong reference to each AVAudioPlayer you create or else you will not hear a thing.
To keep track of multiple AVAudioPlayers store them in an array, and remove them from the array when they are finished playing (which you can find out using the audioPlayerDidFinishPlaying:successfully: delegate method).
Keep in mind that touchesMoved:withEvent: may be triggered in a super high tempo, so your array may grow too large. It's wise to only play a sound when something acutally happens on the screen, such as the next piano key being touched, or to keep a counter and only play a sound every n touches.

UISlider with sound effect and vibration

I need to do a lot of things with UISlider. First of all I want to know what are all the things are possible and what are not. Please give me ideas for the doable ones.
I need to add a slider control in my iPhone application (that should resemble the one which is displayed in the iphone when the phone is getting charged).
Can the round button of the UISlider be changed to any other shape. Can any image be added on top of that round button?
When the UISlider is being moved, we need ad a sound effect(for example car stating sound) and when the sliding ends the sound should be stopped. is this possible? if yes, please gimme ideas to do this. 3. vibration should also happen while sliding (possible?)
Thanks in advance!!!
All of these can be done via the public API. Read the docs :-)
The button is called the "thumb image"; there's a property to replace the image.
Assign a delegate and set the 'continuous' property on the slider.
See the Application Programming Guide for more on delegates.
As far as question number 2, just write up the methods to accomplish playing a sound and vibrating and then have them fire when the value changes on the slider.