The shaking is how to realize it ~ found that the original iOS support
There's a way to do this in Uiresponder.
-(void) Motionbegan: (uieventsubtype) Motion withevent: (uievent *) event __osx_available_starting (__mac_na,__iphone_3 _0);
-(void) motionended: (uieventsubtype) Motion withevent: (uievent *) event __osx_available_starting (__mac_na,__iphone_3 _0);
-(void) motioncancelled: (uieventsubtype) Motion withevent: (uievent *) event __osx_available_starting (__mac_na,__ IPHONE_3_0);
This is the way to perform a shake. So how do you use these methods?
Very simple, you just have to let the controller itself support shaking
At the same time let him be the first corresponding person:
-(void) viewdidload
{
[Superviewdidload];
Additional setup after loading the view, typically from a nib.
[[Uiapplicationsharedapplication] setapplicationsupportsshaketoedit:yes];
[Selfbecomefirstresponder];
}
And then we can get to the next few ways.
-(void) Motionbegan: (uieventsubtype) Motion withevent: (uievent *) event
{
Shake detected
}
-(void) motioncancelled: (uieventsubtype) Motion withevent: (uievent *) event
{
Shake Cancel
}
-(void) motionended: (uieventsubtype) Motion withevent: (uievent *) event
{
Shaking end
if (Event.subtype = = Uieventsubtypemotionshake) {
Something happens
}
}
Shake a shake of IOS