i have a uiswitch in each tableViewCell that initiates a network action. I want to superimpose a uiActivityInidicator over the switch until the server answers. I have seen this done with a uibarbutton.
I have added code to this previously working method that has a subclassed UISwitch, but no spinner is displayed.
any ideas?
- (IBAction)changeState:(id)sender {
Plug *plug = [self.fetchedResultsController objectAtIndexPath: ((NamedUISwitch*)sender).indexPath];
if(((NamedUISwitch*)sender).on){
plug.state = @"1";
} else {
plug.state = @"0";
}
NamedUISwitch *theSwitch=(NamedUISwitch*)sender;
UIActivityIndicatorView *spinner=[[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[spinner startAnimating];
[theSwitch addSubview:spinner];
// send message to server
}