0

내 응용 프로그램에서 비동기 적으로 검색을 수행합니다. 완료되면 위치에 대한 핀이있는 mapViewController가 표시됩니다. 2 초 후, 나는 listViewController로 모달 변환을한다. 배경색을 다음과 같이 설정했습니다.모달 전환 -보기 중 하나가 겉으로보기에 할당 해제 됨

self.view.backgroundColor = [UIColor colorWithWhite:1.0 alpha:0.65]; 

지도 뒤를 볼 수있게 만듭니다.

문제는 다음과 같습니다. listView가 표시된 후 1 초가 지나면지도가 사라지기 전에 잠시 백그라운드에서 볼 수 있습니다. 지금 배경에서 볼 수있는 것은 앱이 시작되는 mainViewController입니다.

그것은 다음과 같습니다 나중에 두 번째보다 더

enter image description here

차감 :

enter image description here

어떤 도움/설명은 크게 감상 할 수있다.

답변

1

보기는 여전히 투명하지만 모달 컨트롤러가 스택 맨 위에 오면보기 뒤의보기가 숨겨집니다. 사용

시도 :

yourController.modalPresentationStyle = UIModalPresentationCurrentContext; 
[yourController present...]; 
+0

불행히도 작동하지 않았다 :/코드를보고 싶으십니까? –

+0

이 게시물을 참조하십시오 http://stackoverflow.com/questions/587681/how-to-use-presentmodalviewcontroller-to-create-a-transparent-view – samir

+0

그 게시물은 정말 도움이 될 것입니다. 고맙습니다! :) –

0
This code seems to work. I hope it will help. 

-(void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    // Do any additional setup after loading the view from its nib. 

    MKMapView *mapView = [MKMapView new]; 
    [self.view addSubview:mapView]; 
    mapView.frame = self.view.bounds; 

    UIGestureRecognizer *gestureRecognizer = [UITapGestureRecognizer new]; 
    [gestureRecognizer addTarget:self action:@selector(displayTransparentVC)]; 
    [self.view addGestureRecognizer:gestureRecognizer]; 
} 

-(void)displayTransparentVC 
{ 
    UIViewController *vc = [TransparentViewController new]; 
    self.modalPresentationStyle = UIModalPresentationCurrentContext; 
    [self presentViewController:vc animated:YES completion:^{ 
    }]; 
}