gpt4 book ai didi

iphone - UIActivityIndi​​catorView 用于为 URL 加载的 UIImage

转载 作者:行者123 更新时间:2023-12-03 20:21:03 25 4
gpt4 key购买 nike

我有一个从 URL 加载的 UIImage,我想在加载图像时显示一个 UIActivityIndi​​catorView 动画。有人可以帮助我吗?

谢谢大家。

最佳答案

所以你想在访问服务器时使用UIActivityIndi​​cator

首先在连接调用时创建指示器,然后在连接完成加载时删除事件指示器

//call this when connection start
UIActivityIndicator *activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
activityIndicator.frame = CGRectMake(140, 236, 37, 37);
[activityIndicator startAnimating];
[self.view addSubview:activityIndicator];
self.view.userInteractionEnabled = NO;

//remove activity indicator while connection did finish loadin
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
[activityIndicator stopAnimating];
[activityIndicator removeFromSuperview];
self.view.userInteractionEnabled = YES;
}

关于iphone - UIActivityIndi​​catorView 用于为 URL 加载的 UIImage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8531676/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com