2014 년 WWDC의 세션 214에서와 같은 팝업을 만들려고합니다.iOS 8 : 블러 효과가있는 UIVisualEffectView를 소형 모드의 모달 팝오버에 적용
가 팝 오버 뷰는 슈퍼 뷰를 채우는 텍스트보기를 포함, 다음과 같이 :
![enter image description here](https://i.stack.imgur.com/HCZEC.png)
:
func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
return .OverFullScreen
}
func presentationController(controller: UIPresentationController, viewControllerForAdaptivePresentationStyle style: UIModalPresentationStyle) -> UIViewController? {
let navigationController = UINavigationController(rootViewController: controller.presentedViewController)
controller.presentedViewController.navigationItem.setRightBarButtonItem(UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Done, target: self, action: "done"), animated: true)
return navigationController
}
를이 나에게 다음 다시했다 sult :
그런 다음 흐림 효과가있는 UIVisualEffectView를 추가하려고했습니다. 처음에는 컨트롤러 뷰에 서브 뷰를 추가하기 만하고 View Hierarchy를 확인한 후에 실제로 내 효과 뷰가 텍스트 뷰 위에 있었지만 텍스트 뷰가 올바르게 배치되었음을 알았습니다. 같은 같은 방법 : atIndex : 그래서 insertSubview 시도
func presentationController(controller: UIPresentationController, viewControllerForAdaptivePresentationStyle style: UIModalPresentationStyle) -> UIViewController? {
let effectView = UIVisualEffectView(effect: UIBlurEffect(style: .Light)) as UIVisualEffectView
effectView.setTranslatesAutoresizingMaskIntoConstraints(false)
controller.presentedViewController.view.insertSubview(effectView, atIndex: 0)
let viewList : [String : UIView] = ["effectView" : effectView]
let navigationController = UINavigationController(rootViewController: controller.presentedViewController)
controller.presentedViewController.navigationItem.setRightBarButtonItem(UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Done, target: self, action: "done"), animated: true)
controller.presentedViewController.view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|[effectView]|", options: nil, metrics: nil, views: viewList))
controller.presentedViewController.view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|-[effectView]|", options: nil, metrics: nil, views: viewList))
return navigationController
}
을하지만 난 여전히 IB에 정의 된 텍스트보기를 제공 드릴 수 없습니다 : 내가 볼 수있는보기 계층 구조를 통해
을 나의 텍스트 인덱스 0에 UIVisualEffectView를 삽입하면 어떻게 든보기가 탐색 막대 아래로 이동합니다.
내 텍스트 아래에 흐림 효과를 프로그래밍 방식으로 설정하지 않고 탐색 표시 줄 아래로 이동하는 방법에 대한 의견이 있으십니까?
환호