shake

Objective C: Detecting a shake

我与影子孤独终老i 提交于 2019-12-22 03:50:48
问题 I'm using the shake api like this: - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { if (event.subtype == UIEventSubtypeMotionShake) { [img stopAnimating]; } } How do I detect that the shaking has stopped? 回答1: You are on the right track, however, there are still more things you need to add to detect shaking: You can test this by adding an NSLog to the motionBegan or motionEnded methods, and in the Simulator, press CONTROL + COMMAND + Z #pragma mark - Shake Functions -

Detecting shaking in html5 mobile

流过昼夜 提交于 2019-12-21 04:57:06
问题 I'm building a web app in html5 at the moment that needs to be able to detect when the user shakes their phone and how fast they are shaking it. I've been browsing around but can't seem to find any examples of how I could implement this. I know html5 has an accelerometer that can detect the orientation of the phone, but how does it detect the speed at which the user is shaking it? Also I'm testing this on my iPhone, although ideally I would like it to work on Android devices too. Thoughts?

How to pass data from one View to other view in IOS using UIStoryboard segues?

倾然丶 夕夏残阳落幕 提交于 2019-12-19 10:44:12
问题 I am using Xcode 4.3.1 . I have created the UI using Storyboard which has many View Controllers. Issue In my app i am using ShakeGesture. While shaking i am doing some operations, its working fine. But, when shaking get stopped i need to pass some values to another View controller to display it. I have seen many post it says how to pass value when button clicked,but no one related with my problem. It would be great if you solve my issue My question is How to pass values from one View to

Shake Device to Launch App

ぃ、小莉子 提交于 2019-12-18 16:59:34
问题 I am using this to work with Shake, and that works fine for me, but i wanna launch application when user shake their device, see my code below: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); transcript=(TextView)findViewById(R.id.transcript); scroll=(ScrollView)findViewById(R.id.scroll); shaker=new Shaker(this, 1.25d, 500, this); } @Override public void onDestroy() { super.onDestroy(); shaker.close(); } public

Strange in ShakeGesture Library on Windows Phone Application

ぐ巨炮叔叔 提交于 2019-12-13 20:36:22
问题 i've a problem with windows phone shakegesture library. I build an application which its shaking the sound will go out and its work nicely but strange bug make me confused. I've two page of it. This is my seperated code : void Instance_ShakeGesture1(object sender, ShakeGestureEventArgs e) { Stream stream = TitleContainer.OpenStream("Sounds/C.wav"); effect = SoundEffect.FromStream(stream); effectInstance = effect.CreateInstance(); if (effectInstance.State != SoundState.Playing ||

Android Shake(Sensor) Service For shake Detection in Application Background

五迷三道 提交于 2019-12-13 12:11:08
问题 I have develop an Application that have shaking functionality for some function to work so i have use shaking class and implement to Main Activity so its work smoothly while Application running but my question is when my application going to sleep or kill or stop then how to detect shake in background (Service) My shacking class public class Shaker implements SensorListener { private static final int FORCE_THRESHOLD = 350; private static final int TIME_THRESHOLD = 200; private static final

Shake Detection iPhone 3.0 not working

不羁岁月 提交于 2019-12-13 08:59:22
问题 I have a ViewController that works perfectly with a button that trigger an action. I would like to replace the button with a shake event so I've googled it around and created a ShakeDetector class that ineherits from UIView and my implementation is as follow: @implementation ShakeDetector - (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event { } - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { if (motion == UIEventSubtypeMotionShake ) { // User was

shaking on 3.0 in a UITableViewController

安稳与你 提交于 2019-12-12 04:07:02
问题 after reading some posts about implementing shaking on 3.0, I think I get the idea but I'm not getting any call to the: motionBegan motionEnded motionCancelled this is an example of what I've read: how to detect and program around shakes for the iphone I'm sure I've added the [self becomeFirstResponder]; and the -(BOOL)canBecomeFirstResponder { NSLog(@"First responder"); return YES; } Should I enable a special delegate for those events ? I understand that those events are controlled by the

Image Rectification for Shake Correction on OpenCV

梦想与她 提交于 2019-12-11 15:04:39
问题 I've 2 pictures of the same scene from an uncalibrated camera. The pics are from a slightly different angle and scale(zoom) and I'd like to superpose them, rejecting any kind of shake. In other words, I should transform them so the shake becomes imperceptible, do a Motion Compensation. I've already tried using a simple SURF (feature) detector along with Homography but sometimes the result isn't satisfactory. So I am thinking about trying Image Rectification to compensate the motion. - Would

Start new activity using onShake method

我与影子孤独终老i 提交于 2019-12-11 07:45:17
问题 I'd like to start new activity by using onShake method. Everything is ok but when new activity starts, onShake command is still possible (when i shake my phone 5 times, new activity starts 5 times). What should I do to shake phone and start new activity only once? Here is my code. public class ACTIVITY extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main