1
我試圖開發一個顯示圖像提要的iphone應用程序。在應用程序中有喜歡ang不喜歡的功能。我需要類似於Instagram的效果。如何添加Instagram模型'like'動畫?
喜歡與不喜歡有獨立的圖像..
我對如何做到這一點困惑。所以我沒有做任何編碼。
是否有任何示例代碼,庫可用?
感謝名單..
我試圖開發一個顯示圖像提要的iphone應用程序。在應用程序中有喜歡ang不喜歡的功能。我需要類似於Instagram的效果。如何添加Instagram模型'like'動畫?
喜歡與不喜歡有獨立的圖像..
我對如何做到這一點困惑。所以我沒有做任何編碼。
是否有任何示例代碼,庫可用?
感謝名單..
在你 - (無效)viewDidLoad中
UITapGestureRecognizer *oneFingerTwoTaps =
[[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(oneFingerTwoTaps)] autorelease];
// Set required taps and number of touches
[oneFingerTwoTaps setNumberOfTapsRequired:2];
[oneFingerTwoTaps setNumberOfTouchesRequired:1];
// Add the gesture to the view/UIImageView
[[self view] addGestureRecognizer:oneFingerTwoTaps];
相反的[自視]使用您的UIImageView。
您在圖像
- (void)oneFingerTwoTaps
{
// Action for Fade In the "Heart"
UIImage *image = [UIImage imageNamed:@"yourlikeimageoverlay.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
//Add the image view to your main view
//(This is optional if it was created with Interface Builder)
...
CABasicAnimation *theAnimation;
//within the animation we will adjust the "opacity"
//value of the layer
theAnimation=[CABasicAnimation animationWithKeyPath:@"opacity"];
//animation lasts 0.4 seconds
theAnimation.duration=0.4;
//and it repeats forever
theAnimation.repeatCount= 1e100f;
//we want a reverse animation
theAnimation.autoreverses=YES;
//justify the opacity as you like (1=fully visible, 0=unvisible)
theAnimation.fromValue=[NSNumber numberWithFloat:1.0];
theAnimation.toValue=[NSNumber numberWithFloat:0.1];
//Assign the animation to your UIImage layer and the
//animation will start immediately
[imageView.layer addAnimation:theAnimation
forKey:@"animateOpacity"];
}
有一個VID或圖片,因爲我不使用的Instagram上創建雙攻的動作下一步所以不知道你指的是什麼,因此可以't給你一個解決方案 – AppHandwerker
你只是想改變單擊按鈕時的圖像? – Ashutosh