嗨,我正在尝试将图像从 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];
}