<style type="text/css"> p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #ffffff} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #ffffff; min-height: 13.0px} p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #00faa0} p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #00b3f9} span.s1 {color: #e339a1} span.s2 {color: #ffffff} span.s3 {color: #00b3f9} span.s4 {color: #8c8af7} span.s5 {color: #ee8e62} span.s6 {color: #00faa0} </style>
- (void)wobble {
static BOOL wobblesLeft = NO;
if (_editing) {
CGFloat rotation = (50 * M_PI) / 180.0;
CGAffineTransform wobbleLeft = CGAffineTransformMakeRotation(rotation);
CGAffineTransform wobbleRight = CGAffineTransformMakeRotation(-rotation);
[UIView beginAnimations:nil context:nil];
NSInteger i = 0;
NSInteger nWobblyButtons = 0;
for (NSArray* buttonPage in _buttons) {
for (TTLauncherButton* button in buttonPage) {
if (button != _dragButton) {
++nWobblyButtons;
if (i % 2) {
button.transform = wobblesLeft ? wobbleRight : wobbleLeft;
} else {
button.transform = wobblesLeft ? wobbleLeft : wobbleRight;
}
}
++i;
}
}
if (nWobblyButtons >= 1) {
[UIView setAnimationDuration:kWobbleTime];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(wobble)];
wobblesLeft = !wobblesLeft;
} else {
[NSObject cancelPreviousPerformRequestsWithTarget:self];
[self performSelector:@selector(wobble) withObject:nil afterDelay:kWobbleTime];
}
[UIView commitAnimations];
}
}
static BOOL wobblesLeft = NO;
if (_editing) {
CGFloat rotation = (50 * M_PI) / 180.0;
CGAffineTransform wobbleLeft = CGAffineTransformMakeRotation(rotation);
CGAffineTransform wobbleRight = CGAffineTransformMakeRotation(-rotation);
[UIView beginAnimations:nil context:nil];
NSInteger i = 0;
NSInteger nWobblyButtons = 0;
for (NSArray* buttonPage in _buttons) {
for (TTLauncherButton* button in buttonPage) {
if (button != _dragButton) {
++nWobblyButtons;
if (i % 2) {
button.transform = wobblesLeft ? wobbleRight : wobbleLeft;
} else {
button.transform = wobblesLeft ? wobbleLeft : wobbleRight;
}
}
++i;
}
}
if (nWobblyButtons >= 1) {
[UIView setAnimationDuration:kWobbleTime];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(wobble)];
wobblesLeft = !wobblesLeft;
} else {
[NSObject cancelPreviousPerformRequestsWithTarget:self];
[self performSelector:@selector(wobble) withObject:nil afterDelay:kWobbleTime];
}
[UIView commitAnimations];
}
}