I used a delegate method to force the update of my view after popToRootViewController. My rootViewController called a network upload class and, on completion, I wanted to reset the form fields on the rootViewController.
In the network upload class, I created a delegate protocol:
@protocol MyNetworkDelegate <NSObject>
@required
- (void) uploadCompleted;
@end
@interface MyNetworkUploader : NSObject{
id <MyNetworkDelegate> _delegate;
}
@property (nonatomic,strong) id delegate;
//other properties here
+(id)sharedManager;
-(int)writeAssessments;
@end
In MyNetworkUploader.m:
-(int)writeAssessments{
//code here to do the actual upload
//.....
//this is a non-view class so I use a global navigation controller
//maybe not the best form but it works for me and I get the required
//behaviour
[globalNav popToRootViewControllerAnimated:NO];
[[globalNav.view viewWithTag:1] removeFromSuperview];
[_delegate uploadCompleted];
}
Then, in my rootViewController:
//my upload is done within a completion block so I know when
//it's finished
typedef void(^myCompletion)(BOOL);
-(void) uploadAssessment:(myCompletion) compblock{
//do the upload
sharedManager=[MyNetwork sharedManager]; //create my instance
sharedManager.delegate=self; //set my rootViewController as the network class delegate
int numWritten= [sharedManager writeAssessments];
compblock(YES);
}
#pragma mark - protocol delegate
-(void)uploadCompleted{
//this is a local method that clears the form
[self clearTapped:nil];
}
I'm NOT proposing that this is the best solution but it worked a treat for me!