popToRootViewController 이후에 내 대리인 메서드를 사용하여 내보기를 강제로 업데이트했습니다. 내 rootViewController가 네트워크 업로드 클래스를 호출하고 완료되면 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];
}
: 내 rootViewController에서, 그리고
-(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];
}
: MyNetworkUploader.m에서
@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
: 네트워크 업로드 클래스에서
, 나는 위임 프로토콜을 만들어 나는 이것이 최선의 해결책이라고 제안하지 않았지만 나를 위해 치료를했습니다!
다양한 유형의보기 컨트롤러를 함께 중첩 시키십니까? 분명히 그것은 지원되지 않습니다 ... http://stackoverflow.com/questions/6859868/popping-viewcontroller-doesnt-call-viewwillappear-when-going-back – RonLugge