Question

downPreView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
downPreView.tag = indexPath;
downPreView.frame = CGRectMake(75,28, 215,60);
downPreView.progress = 0.0;
[cell.contentView addSubview:downPreView];

Now how do I start animating downPreView with a tag of 2, etc? Thanks!

Was it helpful?

Solution

You can grab a view with the viewWithTag method. Like [cell.contentView viewWithTag:1]

Update

First of all. You cant animate a progressView, you can show it, hide it, and you can edit it's progress level. If you want to edit it's progress, you have to set it like [downPreView setProgress:0.1]. If it's set to 1 the progrees indicator will be at the end. However if you want just a spinner, you can use UIActivityIndicatorView. If you cant get the cell, then you can use it's parent view. Like [self.view viewWithTag:1] After this you have to cast UIProgressView on it to avoid warnings.

UIProgressView *progressView = (UIProgressView *)[self.view viewWithTag:1];
progressView.progress = 0.1;

For more info about UIActivityIndicatorView please see the documentation.

OTHER TIPS

You cannot access an object by it's tag, you have to retain the object if you want access. Say if you have an array of progress views... you can enumerate it and ask

if (object.tag == tagWanted) {
doSomething;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top