Ios 活动指示器未显示在图像上

Ios 活动指示器未显示在图像上,ios,iphone,activity-indicator,Ios,Iphone,Activity Indicator,您好,我正在尝试将图像从iphone上传到服务器,因为我给了用户活动指示器,让用户知道图像正在上传,而单击“上传”按钮,它将显示活动指示器几分钟 但我的问题是活动指示器只在少数图像中显示,而不是在所有图像上显示。请告诉我如何解决这个问题 我的活动编码 -(void)temp{ spinner = [[UIActivityIndicatorView alloc initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];

您好,我正在尝试将图像从iphone上传到服务器,因为我给了用户活动指示器,让用户知道图像正在上传,而单击“上传”按钮,它将显示活动指示器几分钟

但我的问题是活动指示器只在少数图像中显示,而不是在所有图像上显示。请告诉我如何解决这个问题

我的活动编码

-(void)temp{
    spinner = [[UIActivityIndicatorView alloc initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    //spinner = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:]
     spinner.frame = CGRectMake(0.0, 0.0, 40.0, 40.0);
    [spinner setCenter:CGPointMake(160, 240)]; // (mid of screen) I do this because I'm in landscape mode
    [self.view addSubview:spinner];
    spinner.color = [UIColor blackColor];
    spinner.backgroundColor = [UIColor colorWithWhite:0.2 alpha:0.4];
    [spinner startAnimating];
    [spinner release];
}

-(void) myMethod{
    [spinner stopAnimating];
    spinner.hidden = YES;
    spinner.color = [UIColor yellowColor];
}

- (IBAction)pushUpload:(id)sender {

    [self temp];
    [self performSelector:@selector(myMethod) withObject:nil afterDelay:5.0f];

}

使用AsynchronousImageView代替ActivityIndicator,它将在加载图像时自动添加ActivityIndicator。
[AsynObj loadImageFromURL:[NSURL URLWithString:ImageUrl]];

您可以从以下链接获取AsyncImageView类



我希望这会有帮助

您是否在imageview上或imageview下添加了指示器???有一点非常清楚,所提供的信息有限。您正试图对多个图像重复使用单个活动指示器。@图像上方的NiravPatel查看其仅在少数图像中显示,但未显示所有图像,请告诉如何解决它。@Desdenova每次按下活动指示器时都应显示,请告诉我如何解决此问题尝试替换此行“spinner.backgroundColor=[UIColor colorWithWhite:0.2 alpha:0.4];“使用微调器。背景色=[UIColor bluecolor];。请检查背景色是否正在更改为蓝色。。。