- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
#import "MyViewController.h"
@implementation MyViewController
@synthesize menuView, gameView, helpView, optionsView, gameButton, helpButton, optionsButton;
- (void) viewDidLoad {
[self setView:menuView];
}
- (IBAction)gotoGame {
[UIView beginAnimations:@"buttonSlide" context: nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationDidStopSelector:@selector(animationDidStop)];
gameButton.center = CGPointMake(104,1000);
[UIView commitAnimations];
}
- (IBAction)gotoHelp {
[self setView:helpView];
}
- (IBAction)gotoOptions {
[self setView:optionsView];
}
- (void)animationDidStop {
NSLog(@"why is this not working?");
[self setView:gameView];
}
@end
不确定什么会有帮助,所以我包含了整个 .m 文件。不管怎样,我是 iPhone 应用程序开发的新手,我正在努力完成我的动画。动画本身工作得很好,但是animationDidStop方法拒绝被调用..即使我按照文档中所示使用setAnimationDidStopSelector。我知道 View 更改有效,因为当我将其放在 gotoGame {} 中的动画之后时,它会切换,但这使得动画不会显示。
有人可以帮助我在动画停止后调用该方法,或者使用计时器在必要的时间后调用它吗? (我也尝试过这个方法,但没有成功)。
最佳答案
不仅需要调用[UIView setAnimationDelegate:self],而且如果动画的调用方法是静态的,则委托(delegate)也必须是静态的。大多数示例使用非静态方法来调用动画,因此如果您使用静态方法来制作动画,这可能会令人困惑(至少对我来说)。
关于iphone - 设置了animationDidStop但没有被调用(iPhone应用程序编码),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1152045/
我正在尝试获取我正在制作的项目的背景 View ,但遇到了一个奇怪的实例。 我的代码是这样设置的。 import Foundation import UIKit class MainMenuViewC
我不确定出了什么问题,我确保将委托(delegate)设置为 self 但它仍然没有被调用。这是代码: override func viewDidAppear(_ animated: Bool)
我有一个群组动画,但我无法检测到何时点击 animationDidStop。我的代码示例: [group setDelegate:self]; [view.layer addAnimation:gro
由于某种原因,我的animationDidStop方法没有被调用,最初我认为这是因为未设置委托(delegate),但经过补救后我仍然遇到同样的问题。有任何想法吗?预先感谢:) - (void)hid
使用 Swift 3.0 运行 tvOS 基本应用程序,这是 View Controller 中的代码...我想在 CAShapeLayer 淡出后删除它。动画完美运行,但是完成方法 animatio
那里。 在 iOS 应用中,核心动画回调不起作用。 - (void)startAnim { CABasicAnimation* anim = [CABasicAnimation animati
我知道您必须使用此方法来获取动画结束时的委托(delegate)方法: - (void)animationDidStop:(CAAnimation *)theAnimation finished:(B
我有一个 CAShapeLayer 数组。在某些时候,我必须遍历该数组并为每一层启动动画。这些动画将层的 bounds.size.height 更改为不同的值(以某种方式计算)。在 animation
我有多个 CAKeyframeAnimation 对象,每个对象都有一个唯一的键,如下所示: ..... [myAnimation setValues:images]; [myAnimation
我正在尝试学习 iOS/iPhone 的核心动画。我的根层包含很多子层( Sprite ),当它们被移除时它们应该旋转...... 我的计划是添加一个旋转动画,然后在调用 animationDidSt
我saw一个lot的 answers关于这个topic ,但无法解决我的特殊情况。 Here is a video with complete animation and logging timeli
我想在前一个动画例程完成后立即开始一个新的动画例程。然而,当前一个确实完成时,新的不会被触发,因为没有调用委托(delegate)方法。我已经委派了一个 View Controller 来处理按钮的
我有两个代码块(也在 another topic 中描述) - (void)AnimateImage:(NSString*)direction{ self.CurrentAnimal.imag
我有一个带有 的 UIView 动画 [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)
Apple 拒绝了我的应用,因为: 3.3.1 Applications may only use Documented APIs in the manner prescribed by Apple
我是一名优秀的程序员,十分优秀!