iPhone SDK: Record time of buttons in a sequence to play back - objective-c

I've got an app in development where you press a button to play a sound using System beep.
Instead of recording the output, I was thinking of recording the timing of when the buttons were pressed, so when the user presses a 'Play' button, the buttons are pressed in the same timing the user has pressed them, so it acts like the iPhone has recorded the sounds, but it's just playing them in sequence. I'd like this to occur once the user has pressed a Record button.
Example:
User presses record
Timing starts
records timing of each button pressed and when
Timing stops after a button has been pressed
PLay button plays back the sequence of events
Can anybody give any ideas on coding, documents to read etc.
Thanks a lot!

http://pastie.org/376474
This should hopefully help you out a bit.
It works in essence, though I haven't actually tested it, so I'm not positive it works.
I assume you can read through it and find a way to fit it in your own code.
Good luck!

Many system time methods have a way to get the value in seconds since the epoch.
Depending on the granularity of the system clock you can just grab the system time of the start button press and grab the time again when each button is pressed.
To calculate the timing just subtract the start time from the button press time.

Related

When clicking on UITableview cell, app quits, sometimes

Have an app that has UITableview with a textfield. Occasionally, when I click on the cell to enter text, the app abruptly ends, but only sometimes. There appears to be no series of actions to duplicate, most of the time the keyboard comes up and there is no problem. I've tried to "walk" through the process but it never fails then.
Any ideas how to track this down or things that you may have had a similar issue. Thanks

How many time will the program calls the increment function when entering the Button control element

When the user enter the Button control element,how many time will the program calls the increment function?
For this question,i don't know how to calculate the numbers that program calls the
increment time,the answer is 2,but i don't know the reason,can anyone explain to me?
Your event case is called when mouse button is clicked on your pane and on your button.
Here, You need to notice that your button is on your pane. It means when mouse down event is happened on your button, in the same time, the event is happened on your pane.
So, when you press down your mouse, Labview will recognize mouse down events are happened twice. one time on your pane and one time on your button.

which best event for touchscreen application?

I have developed an application using VB.NET that uses a touchscreen (it's a Point of Sales app). I have used button click events to execute the code like a normal Windows application. Is this correct way to do it, or should I use MouseUp and MouseDown events?
Using Click events is correct. On a touch screen, tapping a button will generate a Click event, just like it would if you clicked the button with a mouse.
P.S. You mention in the comments that sometimes the application hangs when you click a button. This is most likely caused by the code that responds to the Click event, and is not related to using a touch screen.
Just ran into an issue on our Touch POS app yesterday. The click event is fired twice in some cases on some monitors. It seems that different touchscreen monitors handle the click even differently and some have software to prevent it others do not. The specific issue was that our click event was being fired two times so clicking button "1" would result in "11" Only happened when using the touchscreen not the mouse. The first depress of the button would put "1" and then when you took your finger off the button another "1" would appear. If you debugged the click event it would only be fired 1 time and just put 1 in the field. If you took debug out it went back to 11.
Save yourself the headaches and use MOUSEUP.

Detect iPhone Volume Button Hold? (iOS 8)

Is there a way to detect if any of the volume buttons on the iPhone are being held?
I know you can detect if one has been pressed, but I specifically need to know if one is being held down.
That's not really possible, but you can have an approximation starting a timer every time you get a volume button pressed event, since you'll receive multiple events in succession when the button is hold. If every time you restart the timer, when the button is released the timer will get triggered and you can do whatever you want. 0.5 seconds worked for me.

How can I check whether Exposé is being activated or not?

I'm creating an application that emulates MacBook's multi-touch Trackpad. As you may know, on MacBook's trackpad
if you swipe 4 fingers up, it triggers the Show Desktop.
if you swipe 4 fingers down, it shows the Exposé.
However, if the Show Desktop is being activated and you swipe 4 fingers down, it will come back to the normal mode. The same goes with the Exposé: if the Exposé is being activated and you swipe 4 fingers up, it will also come back to the normal mode.
Here is the problem: I use the keyboard shortcut F3 to show the Exposé and F11 to show the Show Desktop. The problem is, when the Show Desktop is being activated, if I press F3, it will go straight to the Exposé. And when the Exposé is being activated, if I press F11 it will go straight to the Show Desktop. But I want it to behave like Trackpad, which I guess its code may look like this
- FourFingersDidSwipeUp {
if (isExposeBeingActivated() || isShowDesktopBeingActivated()) {
pressKey("Esc");
} else {
pressKey("F11");
}
}
But I don't know how to implement the "isExposeBeingActivated()" and "isShowDesktopBeingActivated()" methods. I've tried creating a window and check whether its size has changed (on assumption that if the Expose is being activated, its size should be smaller), but the system always returns the same size. I tried monitoring the background processes during the Expose, but nothing happened. Does anyknow have any suggestions on this?
(I'm sorry if my English sounds weird.)
As far as I know, there's no public interface to any Exposé related functionality beyond the ability to specify the "collection behavior" of your own application's windows.
came here after reading your email. I understand the problem. After a bit of googling I found out what you already know, that there's really no official API or documentation for Exposé. A very ugly solution I've thought of could be having Exposé trigger a timer equal to the total time it takes to show all windows fully (guessing this is constant). If a swipe up would be done within that timer, it would mean that Exposé would still be active (isExposeBeingActivated()), so you would trigger a cancel instead of a Show Desktop. This wouldn't cover the use of the "slow motion" Exposé (via SHIFT key). Maybe you can detect if it's a normal or "slow motion" Exposé call?
Really sorry if this doesn't make sense at all within your application's scope, guess I'm just really saying the first solution I thought of.
Cheers.
Pedro.