iphone - 动画和调整 UIImageView

标签 iphone ios ipad uiimageview

如何设置 UIImageView 的动画和调整其大小?我试过这样做,但对我来说没有用:

[UIView beginAnimations:nil context:NULL];
            [UIView setAnimationDuration:1.0];
            imgView.frame = CGRectMake(0, 0, 320, 480);
            [UIView commitAnimations];

最佳答案

尝试使用 block 动画:

[UIView animateWithDuration:1.0f // This can be changed.
                 animations:^{
                   CGRect frame = imageView.frame;
                   frame.size.width += 100.0f; // This is just for the width, but you can change the origin and the height as well.
                   imageView.frame = frame;
                 } 
                 completion:^(BOOL finished){
                 }];

希望对您有所帮助!

关于iphone - 动画和调整 UIImageView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8842623/

相关文章:

javascript - 当焦点从一个文本字段更改为另一个文本字段时,如何防止屏幕键盘消失

iphone - 如何更新 NSUserDefault

objective-c - Instagram 如何将 UIKeyboard returnKey 自定义为 '@' 和 '#"?

iphone - 用于音量控制的 IOS 音乐 api

ios - UIViewControllerHierarchyInconsistency - 一个 View 一次最多只能有一个 View Controller

c# - Xamarin iOS 以编程方式展开 Segue 或 DismissViewController 并传回数据

iphone - UILabel 未更新与 IBOutlet 连接

iphone - nivo slider 图像未出现在 ipod/iphone/ipad 上

iphone - Phonegap 1.7中的Childbrowser插件只能第一次打开

iphone - 向App Store提交应用程序:开发人员拒绝