ios - UIView 摆动

标签 ios objective-c animation

如何实现模拟钟摆运动的 UIView(在本例中为 ImageView )的动画?我希望它从左向右摆动并重复。

最佳答案

[UIView animateKeyframesWithDuration:0.3f delay:0.f options:UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse animations:^{
    [self.imgview setFrame:CGRectMake(self.imgview.frame.origin.x + 50 ,self.imgview.frame.origin.y, self.imgview.frame.size.width, self.imgview.frame.size.height)];

} completion:^(BOOL finished) {

}];

关于ios - UIView 摆动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30139457/

相关文章:

ios - 如何在 Core Data 中保存有关系的实体

javascript - 点击div切换动画?

ios - 如何在长时间按压后停止我的 UICollectionViewCell 摇晃?

html - 从xcode中的数组加载本地html

ios - "The file “IMG_xxxx.JPG” 无法打开,因为没有这样的文件。”

iOS 8 : UINavigationController popping without animation and then pushing

css - 悬停时取消 CSS3 动画

ios - 如何强制纵向?

ios - 在uitableveiw中滑动,“删除”按钮不会出现。另外,当我快速滑动时,也会出现删除按钮

iphone - MKOverlayView 中的裁剪 :drawMapRect