views:

128

answers:

1

So, my UITableViewCell has UITableViewCellAccessoryDetailDisclosureButton, and when somebody clicks on it it make long time just to show next view screen... so I want to show some "rolling wait image" (UIActivityIndicatorView ?) say next to UITableViewCellAccessoryDetailDisclosureButton in this cell, but how do I do it right? How to use UITableViewCellAccessoryDetailDisclosureButton properly?

Thank you.

A: 

You can use a UIActivityIndicator as a UITableViewCellAccessory like so:

UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[activityView startAnimating];
cell.accessoryView = activityView;
[activityView release];
Tom Irving
Say I am in - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { ... }How do I get cell object there?
alexeypro
Have a BOOL declared in your .h file, called "shouldSpin". Set it to NO initially. In cellForRowAtIndexPath, check the BOOL. If it's NO, don't display the spinner, if YES, do.In didSelectRowAtIndexPath, change the value of the BOOL to YES and reload the table. In addition to that you could have an indexPath you update with the row selected, and only show a spinner on that path.
Tom Irving