1
나는 현재 내가 가지고있는 스크린 캡쳐를 얻으려고하고 있는데, 다음 뷰 컨트롤러를 오버레이 할 때 그 뒤에 이미지 뷰를 만들 수 있고 반투명 한 것처럼 보이게 할 수있다. . 이것은 작동하지만 지금은 중간에 이상한 회색을 만듭니다. 여기에 내가 사용하고있는 코드입니다 : 여기화면 캡쳐 - 기이 한 회색 영역
func requestOverride(overrideReason : String, notificationName : Notification.Name) {
captureScreen { (image) in
ManagerOverride.image = image
let vc = UIStoryboard(name: "ManagerOverride", bundle: nil).instantiateViewController(withIdentifier: "overrideNav") as! UINavigationController
let over = vc.viewControllers.first as! ManagerOverrideViewController
let _ = over.view
over.overrideReason.text = overrideReason
over.notifyName = notificationName
UIApplication.shared.keyWindow?.currentViewController()?.present(vc, animated: true, completion: nil)
}
}
func captureScreen(completion: @escaping (UIImage) ->()) {
let view = UIApplication.shared.keyWindow!.currentViewController()!.view!
UIGraphicsBeginImageContextWithOptions(view.bounds.size, false, UIScreen.main.scale)
view.layer.render(in: UIGraphicsGetCurrentContext()!)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
completion(image!)
}
하고 있는지 내가 다시 점점 오전 :
나는 그것의 맥락에서