Activity indicators when clicked as follows - didSelectRowAtIndexPath

I can successfully click only the following view in my iPhone application. However, for the next view to retrieve the data to fill UITableViews, sometimes the wait time may be a few seconds or a little longer depending on the connection.

During this time, the user may think that the application is blocked, etc. Therefore, to counter this problem, I think that implementation UIActivityIndicatorswould be a good way to tell the user that the application is working.

Can someone tell me where I could implement this?

Thank.

pushDetailView method

- (void)pushDetailView {

[tableView deselectRowAtIndexPath:indexPath animated:YES];
//load the clicked cell.
DetailsImageCell *cell = (DetailsImageCell *)[tableView cellForRowAtIndexPath:indexPath];

//init the controller.
AlertsDetailsView *controller = nil;
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
    controller = [[AlertsDetailsView alloc] initWithNibName:@"DetailsView_iPad" bundle:nil];
} else {
    controller = [[AlertsDetailsView alloc] initWithNibName:@"DetailsView" bundle:nil];
}

//set the ID and call JSON in the controller.
[controller setID:[cell getID]];

//show the view.
[self.navigationController pushViewController:controller animated:YES];
+3
source share
1

didSelectRowAtIndexPath:.

UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle: UIActivityIndicatorViewStyleWhiteLarge];
cell.accessoryView = spinner;
[spinner startAnimating];
[spinner release];

, , - .

: , . ActivityIndicator didSelectRowAtIndexPath: .

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {  

    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle: UIActivityIndicatorViewStyleWhiteLarge];
    cell.accessoryView = spinner;
    [spinner startAnimating];
    [spinner release];

    [self performSelector:@selector(pushDetailView:) withObject:tableView afterDelay:0.1];
}

- (void)pushDetailView:(UITableView *)tableView {

    // Push the detail view here
}
+6

All Articles