상황을 작동하지 않는 것은 다음과 같이이다 : - IMAGE_1 스위프트 3 회전이 제대로
- IMAGE_2을 표시
다른 튜토리얼을 시도했지만 여전히 문제가 있습니다.
// MARK:- Orientation
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
if UIDevice.current.orientation.isLandscape {
let endpoint = URL(string: "http://xx.xx.x.xx")
do {
let data = try Data(contentsOf: endpoint!)
img_card_logo.image = UIImage(data: data)
img_card_logo.frame = UIScreen.main.bounds
img_card_logo.backgroundColor = .black
self.navigationController?.isNavigationBarHidden = true
self.tabBarController?.tabBar.isHidden = true
} catch {
print("Error")
}
print("Landscape Mode")
} else {
let endpoint = URL(string: "http://xx.xx.x.xx")
do {
let data = try Data(contentsOf: endpoint!)
img_card_logo.image = UIImage(data: data)
self.navigationController?.isNavigationBarHidden = false
self.tabBarController?.tabBar.isHidden = false
} catch {
print("Error")
}
print("Potrait Mode")
}
}
에뮬레이터를 여러 번 회전하면 이미지 만 나타나지만 인쇄 문은 올바르게 작동합니다.
정말 도움이됩니다.
왜이 라인을 작성하지 않았습니까? img_card_logo.image = UIImage (data : data) portraint는 필요하지 않습니다. – KKRocks
@KKRocks potrait와 풍경의 이미지가 달랐습니다. 다른 URL에서로드해야합니다. – Sariyanti
귀하의 진술에 혼란스러워 ** ** 초상화 모드의 앱 ** - ** – KKRocks