iPhone 屏幕,长按某程序图标,所有的图标都在颤抖,并且可以拖动,进行位置的更换,点“X”可以删除。这种效果我该怎么实现呢?书架上放的按钮 按钮显示图片以及文字,该怎么清理掉呢 请大侠给个DEOM吧,不胜感激!!!!
我的想法是:用两个按钮 a按钮 一个按钮显示图片和文字 b按钮的类型改 add contact 然后在b按钮上放个x的图片 并隐藏 当点击a按钮时触发事件 然后将b按钮显示出来 然后点击b按钮 触发事件 然后将a按钮和b按钮全部移除 或隐藏
同求 那个按钮不是难点 关键是摇晃阿 我试过 用NSTimer控制它摇晃 感觉很是不自然
参考下three20 里面的Launcher,源码中有一个方法- (void)wobble
可以参考Core.Animation:Simplified.Animation.Techniques.for.Mac.and.iPhone.Development(Addison.Wesley.2010-01)这本书,上面有个实现
把代码贴上来吧,具体可以去看LS说的那本书:
-
(void)ShakeMyView {//开始晃动
UIImageView* tt = (UIImageView*);
forKey:@“beginAnimation”];
} -
(void)RemoveShake {//停止晃动
UIImageView* tt = (UIImageView*);
;
} -
(CAAnimation*)shakeAnimation {
CAKeyframeAnimation * animation;
animation = ;
;
;
// Try to get the animation to begin to start with a small offset // that makes it shake out of sync with other layers. srand( timeIntervalSince1970]);
float rand = (float)random();
;
NSMutableArray *values = ; // Turn right
]; // Turn left
]; // Turn right
]; // Set the values for the animation
;
return animation;
} -
(NSNumber*)DegreesToNumber:(CGFloat) degrees {
return ];
} -
(CGFloat)DegreesToRadians:(CGFloat) degrees {
return degrees * M_PI / 180;
}