Tag: uiviewanimation

UIView中的iOS完成块animateWithDuration会被调用得太早

我试图做一些animation时,表格视图单元格被选中。 出于某种原因,完成块被调用得太早了。 即使将持续时间设置为10秒,也会立即调用完成块。 [UIView animateWithDuration:10.0 animations:^{ message.frame = newFrame; } completion:^(BOOL finished) { NSLog(@"DONE???"); }]; 任何想法,为什么发生这种情况? 谢谢。

隐藏属性不能在animation块中更改

我在UIStackView中embedded了两个UILabel。 顶部标签始终保持可见,但底部标签通过hidden属性来打开和closures。 我想这个效果是animation的,所以我把它卡在一个animation块中: private func toggleResultLabel(value:Double) { if value == 0 { UIView.animateWithDuration(0.25) { () -> Void in self.resultLabel.hidden = true } } else { UIView.animateWithDuration(0.25) { () -> Void in // Something weird is happening. I had to add 3 of the same statements to get // the hidden flag to be false self.resultLabel.hidden […]

如何使像打开门的UIImageViewanimation

我试图创build一个看起来像2个法式门(或2个舱门)的animation,向用户开放。 我尝试使用内置的UIViewAnimationOptionTransitionFlipFromRight过渡,但过渡的起源似乎是UIImageView的中心,而不是左边缘。 基本上我有2个UIImageViews,每个填充有屏幕。 我希望animation看起来像UIImageView从屏幕中心到边缘。 [UIView transitionWithView:leftView duration:1.0 options:UIViewAnimationOptionTransitionFlipFromRight animations:^ { leftView.alpha = 0; } completion:^(BOOL finished) { [leftView removeFromSuperview]; }]; 有没有人做过这样的事情? 任何帮助都是极好的! 更新:工作代码感谢尼克洛克伍德 leftView.layer.anchorPoint = CGPointMake(0, 0.5); // hinge around the left edge leftView.frame = CGRectMake(0, 0, 160, 460); //reset view position rightView.layer.anchorPoint = CGPointMake(1.0, 0.5); //hinge around the right edge rightView.frame = CGRectMake(160, 0, […]

如何在Xcode中animationUIView的宽度和高度?

我有这个子视图我想添加到我的主视图,但使其从原点扩大。 我读了一些苹果的文档,但我不明白我在哪里犯错。 我可以animation框架的起源,即让它从任何地方滑动,但宽度/高度似乎并不animation。 代码如下: [UIView beginAnimations:@"animateAddContentView" context:nil]; [UIView setAnimationDuration:0.4]; customView.frame= CGRectMake(self.view.frame.origin.x +5, self.view.frame.origin.y +5, 0, 150); [self.view addSubview:customView]; customView.frame= CGRectMake(self.view.frame.origin.x +5, self.view.frame.origin.y +5, 310, 150); [UIView commitAnimations]; 我也尝试把这样的animation只setFrame部分: customView.frame= CGRectMake(self.view.frame.origin.x +5, self.view.frame.origin.y +5, 0, 150); [self.view addSubview:customView]; [UIView beginAnimations:@"animateAddContentView" context:nil]; [UIView setAnimationDuration:0.4]; customView.frame= CGRectMake(self.view.frame.origin.x +5, self.view.frame.origin.y +5, 310, 150); [UIView commitAnimations]; 但是它仍然不起作用! 编辑: 根据这些build议,我已经把它移动到一个基于块的animation解决scheme,这是确切的代码: NSLog(@"yourview […]

如何在swift中实现关键字关联函数?

例如,当我input几个字母时,相应的单词会自动显示,然后我可以select它们。 但是如何实现这种function呢? 我应该使用哪种UI元素? 我是否也应该input世界上所有国家的绳索数据,以便得到相应的结果?

iOS UIViewanimation问题

在UITabBarController中切换页面时遇到UIViewanimation问题。 UIViewControllerA中的视图正在播放以下animation: [UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationOptionRepeat | UIViewAnimationOptionCurveLinear | UIViewAnimationOptionBeginFromCurrentState animations:^{ CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI); self.animationImageView.transform = transform; } completion:NULL]; 该animation是一个自定义加载轮,当一首歌曲已经加载时停止。 如果我在页面之间切换,即从UIViewControllerA到UIViewControllerB,然后在UITabController中返回到A,则animation停止。 当我尝试重新启动它时,它不再animation。

快速翻转翻转animation全视图而不是子视图

我需要切换两个子视图,因为我使用翻转animation,但它翻转整个屏幕不子视图。 这是我用来翻转的代码: UIView.transitionFromView(frontView, toView: backView, duration: 1, options: UIViewAnimationOptions.TransitionFlipFromRight | UIViewAnimationOptions.ShowHideTransitionViews, completion: nil) 我在StoryBoard中创build了frontView和backView,并且最初隐藏了backView。 请帮助我只翻转子视图。

UIView animateWithDuration和UIProgressView setProgress

我想在10秒内将我的UIProgressView进度从0增加到1。 码: [UIView animateWithDuration:10.0 animations:^{ [_myProgressView setProgress:1 animated:YES]; } completion:(BOOL finished)^{ if (finished) NSLog(@"animation finished); }]; animation工作正常,除了完成和NSLog总是立即调用。 我尝试了animateWithDuration: withDelay:但延迟不被尊重和立即执行。 有没有人遇到同样的问题? 感谢您的帮助。

有UIViewanimation允许交互的问题

我有以下代码块淡出introView(UIView) // Hide intro view after 5 seconds [UIView animateWithDuration: 1.0 delay: 5.0 options: (UIViewAnimationOptionAllowUserInteraction |UIViewAnimationOptionCurveLinear) animations: ^{ introView.alpha = 0; } completion: ^(BOOL finished) { [introView removeFromSuperview]; }]; 我在introVew里有一个跳过button,但是没有任何交互,我错过了什么吗? 我必须添加这是一个通用的应用程序目标3.2和我使用XCode 4.2

用BOOL /完成块停止自动反向/无限重复UIViewanimation

我设置了以下UIView animateWithDuration:方法,目的是在程序的其他地方设置我的animationOn BOOL来取消无限循环的重复。 我的印象是,每当animation的一个循环结束时就会调用completion块,但看起来并不是这样。 completion块是否在重复animation中被调用? 如果不是,还有另一种方法可以阻止这种方法以外的animation? – (void) animateFirst: (UIButton *) button { button.transform = CGAffineTransformMakeScale(1.1, 1.1); [UIView animateWithDuration: 0.4 delay: 0.0 options: UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat animations: ^{ button.transform = CGAffineTransformIdentity; } completion: ^(BOOL finished){ if (!animationOn) { [UIView setAnimationRepeatCount: 0]; } }]; }