2016-08-16 2 views
0

투명한 배경을 가진 모달 뷰 컨트롤러를 만들고 싶었지만 배경의 알파를 0.5로 설정하면 뷰가 완전히 뒤틀어졌습니다. 이는 전환 후 배경보기가 제거되기 때문입니다. 투명한 배경을 가진 Objective-C 모달 뷰 컨트롤러

self.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5]; 
[self setModalPresentationStyle:UIModalPresentationFullScreen]; 
[self setDefinesPresentationContext:YES]; 

그런 다음보기를 변경하려면 firstViewController에서 버튼의 행동이 코드를 시도 링크 image/linke.gif

+2

[iOS - 반투명 모달보기 컨트롤러] 가능한 복제본 (http://stackoverflow.com/questions/18902059/ios-semi-transparent-modal-view-controller) –

+0

정확한 @JamesP .. – vaibhav

답변

0

봐주세요보기 컨트롤러 코드

SecondViewController *alertView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil]; 
[self presentViewController:alertView animated:YES completion:nil]; 

을 제시 컨트롤러 및 새로운 클래스를 제시 secondViewController

secondViewController *VC = [self.storyboard instantiateViewControllerWithIdentifier:@"secondViewController"]; 

    VC.view.backgroundColor=[UIColor colorWithWhite:0 alpha:0.1f]; 
    VC.modalPresentationStyle=UIModalPresentationOverCurrentContext; 
    [self presentViewController:VC animated:NO completion:nil]; 
관련 문제