iphone - 使用C#在单点触控iPhone项目上的动画 View

标签 iphone ios ipad xamarin.ios uiviewanimation

public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();

            // Perform any additional setup after loading the view, typically from a nib.
            List<UIImage> myImages = new List<UIImage>();
            myImages.Add(UIImage.FromFile(@"image/1.jpeg"));
            myImages.Add(UIImage.FromFile(@"image/2.jpeg"));
             var myAnimatedView = new UIImageView(this.hatchAgeSubView.Bounds);
            myAnimatedView.AnimationImages = myImages.ToArray();
            myAnimatedView.AnimationDuration = 3; // Seconds
            myAnimatedView.AnimationRepeatCount = 4; // 0 = Loops Forever
            myAnimatedView.StartAnimating();
            hatchAgeSubView.AddSubview(myAnimatedView);
        }

如您在上方看到的那样,有一个动画包含两个图像,持续12秒。
我想在12秒后开始另一个动画。 (在以上动画的结尾)

是否有任何回叫方法或是否有使下一个动画自动播放的想法??

最佳答案

如果您使用的是iOS 4或更高版本,则可以使用新的Animate方法,并在第一个动画序列完成时得到通知:

var delay = 0.0f;
UIView.Animate(delay, () => {
    UIView.SetAnimationRepeatCount(4);
    //Regular animation code goes here.

}, () => {
    // This fires when the first animation block above is completed
    //Second animation sequence code goes here.
});

更新:请不要从ViewDidLoad调用动画,这会使体验缓慢并且用户不满意。尝试从ViewDidAppear异步调用它。有关“查看事件”的更多信息,请查看我关于该主题的博客文章:

http://blog.devnos.com/uiviewcontroller-y-u-no-fire-view-events

关于iphone - 使用C#在单点触控iPhone项目上的动画 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9556734/

相关文章:

iphone - 重新加载 UITableView 有 UITableViewCell 可见性问题

iphone - UITableview 基于滚动添加表格单元格

ios - 动画 View 中的 UIButton 未检测到触摸

ios - 调整视频大小并保持 1 :1 scale

ios - iPad - DetailViewController 以编程方式

iPad 中的 Css 问题

iphone - UIPageViewController 在旋转时重置为第一页

ios - 如何将静态 UIButton 覆盖在 UITableView 上

iphone - 当项目设置允许所有旋转时,在特定 View Controller 中禁用旋转

ios - 从 firestore 下载一系列文档