0

나는 ARKIT을 사용하여 증강 현실 예제를보고 있습니다. 카메라보기 상단에 단추를 추가하여 닫으려고하므로 이전 화면으로 이동합니다. 보기를 닫으려고하면 카메라가 닫히고 카메라 셔터가 닫히는 애니메이션에서 멈추거나 멈 춥니 다. (이 시점에서 나는 버튼을 다시 볼 수 있습니다. 다시 누르면 앱이 충돌합니다).iPhone -보기 해제 문제

현재 설정은 다음과 같습니다 : Main Menu View -> ARViewController -> Augmented Reality Controller. 누군가 내가 어디로 잘못 가고 있는지 말해 줄 수 있습니까? 또는 모든 뷰를 강제로 닫고 기본 메뉴를 표시하는 쉬운 방법은?

.h 
AugmentedRealityController *agController; 

.m 
- (void)loadView { 
self.agController = [[AugmentedRealityController alloc] initWithViewController:self];} 

- (void)viewDidAppear:(BOOL)animated 
{ 
    [agController displayAR]; 
} 

- (void) scanButtonPressed {  //action when button is pressed 
    [agController hideAR];  //dismiss camera 
    [self dismissModalViewControllerAnimated:YES]; //dismiss current view 
} 

증강 현실 컨트롤러

ARViewController

메인 메뉴

if([ARKit deviceSupportsAR]) 
{ 
    ARViewController *viewController = [[ARViewController alloc] initWithDataSource:self]; 
    viewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 
    [self presentModalViewController:viewController animated:YES]; 
    [viewController release]; 
} 

: 여기

몇 가지 코드
- (void) hideAR { 
    [[self locationManager] stopUpdatingHeading]; 
    [[self locationManager] stopUpdatingLocation]; 

    [[self accelerometerManager] release]; 

    [rootViewController dismissModalViewControllerAnimated:YES]; 
} 

// This is needed to start showing the Camera of the Augemented Reality Toolkit. 
-(void) displayAR {  
    [rootViewController presentModalViewController:[self cameraController] animated:NO]; 
    [displayView setFrame:[[[self cameraController] view] bounds]]; 
} 

(프로젝트 https://github.com/kypselia/ARKit/blob/d4c018ce74e7c1abd786b6faa71d76435e52246f/ARKit/ARViewController.m의 원본 소스 코드)

답변

0

확실하지가 문제를 해결할 수 있지만 한 번만 dismissModalViewControllerAnimated를 사용하여 시도하고 THT도이 도움이 될 것입니다

[self dismissModalViewControllerAnimated:YES]; 

희망을 사용해야합니다. ..