草庐IT

untitled-animations

全部标签

ios - 使用 Core Animation 改变 cornerRadius

我正在尝试通过以下方式更改按钮(OpenNoteVisible.layer)的角半径:CABasicAnimation*animation=[CABasicAnimationanimationWithKeyPath:@"cornerRadius"];animation.timingFunction=[CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionLinear];animation.fromValue=[NSNumbernumberWithFloat:10.0f];animation.toValue=[NSNumb

ios - presentViewController :animated:completion: broken in iOS 6. x的ARC内存管理?

我的ViewController通过presentViewController:animated:completion:方法呈现一个View。View显示良好。然后我关闭这个View并重新呈现它并得到以下崩溃:***-[WebBrowserisKindOfClass:]:messagesenttodeallocatedinstance0x1f640ac0我的代码使用的是ARC。这是我的WebBrowser类的代码,这是一个简单的嵌入式浏览器。浏览器.h:@interfaceWebBrowser:ITViewController@property(nonatomic,strong)NSS

ios - 自动布局 : animating changes to NSLayoutConstraint's multiplier

我有这个简单的观点:-(void)viewDidLoad{[superviewDidLoad];redBox=[[UIViewalloc]init];[redBoxsetBackgroundColor:[UIColorredColor]];[redBoxsetTranslatesAutoresizingMaskIntoConstraints:NO];[self.viewaddSubview:redBox];//H:widthConstraint=[NSLayoutConstraintconstraintWithItem:redBoxattribute:NSLayoutAttribute

iPhone : Best way to detect the end of UIImageView image sequence animation

我们知道UIImageView对图像序列动画有很好的支持。我们可以轻松地创建一个UIImage对象数组,设置animationImages属性,配置动画持续时间,重复次数等,然后就可以触发了。但是似乎没有办法知道这个动画什么时候结束。假设我有十张图片,然后我想用它们运行一个动画(重复计数=1)。当动画结束时,我想运行一些其他代码。知道动画已经结束的最佳方式是什么?我已经知道我可以创建一个NSTimer并安排它在动画持续时间后触发。但是如果你需要很好的精度,你真的不能依赖计时器。所以我的问题是,有没有更好的方法可以在不使用计时器的情况下知道UIImageView图像序列动画已经结束?代码

iphone - MKMapView setRegion animated 不显示动画

我有一个MKMapView和annotationpins。加载View时,会搜索最近的图钉,map将缩放,以便同时显示用户的位置和最近的图钉。我用[mapsetRegion:regionanimated:YES];来做到这一点。到这里为止一切正常。还可以通过点击定位用户的按钮来调用相同的方法,然后执行我刚才描述的操作。我还有一个搜索字段,用户可以使用它来搜索map点。当用户点击其中一个搜索结果时,map会设置区域,以便搜索到的图钉位于中间。现在,这有点奇怪。我还设置了这个区域动画,至少我执行了与上面相同的命令。但是,如果map点距离map当前可见部分太远,则在更改区域时不会显示动画。我

ios - UIPageViewController 手势正在调用 viewControllerAfter : but doesn't animate

我有一个关于UIPageViewController的非常有趣的问题。我的项目设置与基于页面的应用程序模板示例非常相似。时不时地(但在一定程度上可重现)某个平移手势会调用-(UIViewController*)pageViewController:(UIPageViewController*)pageViewControllerviewControllerAfterViewController:(UIViewController*)viewController。我返回下一页的ViewController,但从未运行过翻页动画,也从未调用过我的委托(delegate)方法。这是viewC

ios - 使用 Core Animation 淡出发射器单元

我正在使用CAEmitterLayer和CAEmitterCell实例创建粒子动画。动画没有问题,但我希望它们慢慢淡出。我正在使用下面的代码,但粒子突然消失,那里没有淡出动画。NSString*animationPath=[NSStringstringWithFormat:@"emitterCells.%@.birthRate",cell.name];CABasicAnimation*birthRateAnimation=[CABasicAnimationanimationWithKeyPath:animationPath];birthRateAnimation.fromValue=[

swift - `catMaybe as? Animal` 和 `catMaybe as Animal?` 之间的区别

假设我有这些:classAnimal{}classCat:Animal{varmeow="meow"}现在我有一个变量:varcatMaybe:Cat?=/*...*/稍后我会这样做:varobj1=catMaybeasAnimal?//①它编译得很好,但我也可以编写其他代码:varobj2=catMaybeas?Animal//②只有这一次我收到警告。这让我感到困惑,因为我认为两者都在做同样的事情。warning:castfrom'Cat?'tounrelatedtype'Animal'alwaysfailsvarobj4=catMaybeas?Animal~~~~~~~~^~~~~

ios - 静态方法中的 UIAlertController 给出错误 : extra argument animated in cell

我希望创建一个静态方法,我可以将其放置在实用程序类中,该实用程序类将启动UIAlertController。但是,我收到以下错误:"extraargumentanimatedincell"staticfuncsimpleAlertBox1(msg:String)->Void{letalertController=UIAlertController(title:"Alert!",message:msg,preferredStyle:.actionSheet)letdefaultAction=UIAlertAction(title:"OK",style:.default,handler:n

swift - 如果我使用的是 UIView.animate,我 Mac 的 CPU 负载高达 200%

如果我对28个UIViewImages使用UIView.animate,其中它们的alpha从alpha=0更改为alpha=0.5。模拟器将我的MacbookCPU加载到200%,但XCode调试导航器中的模拟器仅显示0-4%的CPU负载。如果我在iPhoneX上运行该应用程序,一切都一样。iPhoneCPU为0-4%,但设备温度很高。如果我是评论动画功能,应用程序运行良好,iPhone温度正常。28View同步动画是正常情况吗?还是不应该这样?添加View的函数funcaddView(){for_in0...27{imageViews.append(UIImageView(imag