popToRootViewControllerAnimated
메서드를 사용하려고하면 화면이 검게 변합니다. 내 장치를 가로 방향으로 회전하면보기가 올바르게 표시되기 때문에 실제로 예상되는보기로 돌아갈 것이라고 생각합니다.navigationController를 사용하는 iOS popToRootViewControllerAnimated
의 ViewController A가 탐색 컨트롤러에 중첩된다 : 여기
내 응용 프로그램의 맥락이다. 뷰 콘트롤러 B의 viewDidLoad 메소드에서 서버 헬퍼 데이터베이스의 일부 데이터를 수집하기 위해 연결 도우미가 생성됩니다. 생성되는 동안 도우미가 장치가 인터넷에 연결되어 있는지 확인합니다. 의 ViewController의 A. 여기로 돌아가라고 그 다음 "이을 popToRootViewControllerAnimated"아니에요 경우 도우미의 코드입니다 :
+(AFHTTPClient*) getClient {
if (!client) {
[self createClient];
}
if (client.networkReachabilityStatus <AFNetworkReachabilityStatusReachableViaWWAN) {
[currentController.navigationController popToRootViewControllerAnimated:YES];
//[[[UIAlertView alloc] initWithTitle:@"Connection Problem" message:@"You don't seem to be connected to internet. Please enable WI-Fi or 3G then try again." delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil] show];
client = nil;
}
return client;
}
+(void) createClient{
NSURL* baseUrl = [NSURL URLWithString:[[@"http://" stringByAppendingString:[ApplicationTask GetApiUrl]] stringByAppendingString:@"/"]];
client = [AFHTTPClient clientWithBaseURL:baseUrl];
client.parameterEncoding = AFJSONParameterEncoding;
[client registerHTTPOperationClass:[AFJSONRequestOperation class]];
[client setDefaultHeader:@"Accept" value:@"application/json"];
[client setDefaultHeader:@"Content-Type" value:@"application/json"];
}
불려와 "popToRootViewControllerAnimated"방법 일단은, 내가 볼 수 있습니다 컨트롤러에서보기 슬라이딩 및 검정 화면이 표시됩니다.
앞에서 언급했듯이 뷰 컨트롤러 A (뷰에서 세로 방향에서 가로 방향으로 장치 회전시키기)로 돌아온 것처럼 느껴지지만보기가 화면 프레임과 비슷하게 보입니다.
희망은 모두 명확하게 만들었습니다.
감사
이 스레드 (http://stackoverflow.com/questions/5301014/ios-popviewcontroller-unexpected-behavior) 덕분에 나는 생각하는 해결책을 찾기에 좋은 길을 가고 있습니다. viewdid에 루트 컨트롤러가 나타나면 모든 것이 잘 동작합니다. 나는 그것이 정말로 애니메이션의 문제라고 생각한다. – Regis