objective-c - 当 UIImageView 图像完成加载时停止动画 UIActivityIndi​​catorView

标签 objective-c ios uiimageview

我想在 UIImageView 上显示旋转的事件 View ,并在图像加载完成并显示后停止并隐藏事件 View 。该图像是从 Assets 库中拍摄的大照片。

- (void)viewDidLoad
{
    //set photo
    UIImageView *Photo = _photo;
    NSURL *url = [[NSURL alloc] initWithString:project.photo];
    ALAssetsLibrary* library = [[ALAssetsLibrary alloc] init];

    [library assetForURL:url resultBlock:^(ALAsset *asset) {

        ALAssetRepresentation *rep = [asset defaultRepresentation];
        CGImageRef iref = [rep fullResolutionImage];
        if (iref) {
            self.photo.image = [UIImage imageWithCGImage:[rep fullScreenImage] scale:[rep scale] orientation:0];

        }
             } failureBlock:^(NSError *error) {

                 NSLog(@"Couldn't load asset %@ => %@", error, [error localizedDescription]);



             }];

    [_ImageLoader stopAnimating];
}

然而,这不起作用,因为事件 View 一直在旋转。

最佳答案

微调器始终是动画的,因为

- (void)viewWillAppear:(BOOL)animated;

之后调用
- (void)viewDidLoad

所以基本上你告诉微调器在告诉它停止后动画。

祝你好运!

关于objective-c - 当 UIImageView 图像完成加载时停止动画 UIActivityIndi​​catorView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10010629/

相关文章:

objective-c - 带圆角的 UIView CAGradient?

iOS 模拟器恢复位置设置

ios - shouldAutorotateToInterfaceOrientation 返回 YES

iphone - 动态使用 UIViewContentModeScaleAspectFit 和 UIViewContentModeScaleAspectFill

iphone - 确定 UIImageview 上是否有图像

ios - OpenGL 层在 presentRenderBuffer 上变黑

ios - 如何在 MBCalendarKit 中通过 JSON 添加事件

ios - 更新数据后 setContentOffset 不起作用

ios - 取消对自定义 segue 的操作

Swift:从一个 View 转换到另一个 View 时的动画效果