이동 방향이 바뀌면 가로 방향으로 하나의 단추를 숨겨야하는 사용자 지정 키보드를 만들고 있는데 어떻게해야합니까? 아래 코드를 사용하고 있습니다. 이 일을 도와주세요. 풍경 또한 버튼은 viewDidLoad
에서방향 변경시 스위프트 높이 변경 및 uibutton 가로 변경시 숨기기
override func updateViewConstraints() {
super.updateViewConstraints()
// Add custom view sizing constraints here
var currentDevice: UIDevice = UIDevice.currentDevice()
var orientation: UIDeviceOrientation = currentDevice.orientation
if orientation.isLandscape {
button.hidden = true
}
if orientation.isPortrait {
button.hidden = false
}
}
여기에 코드가 없습니다. 문제가 무엇인지 설명해주십시오. 코드 작성 방법을 묻지 마십시오. –
내 문제는 방향이 바뀌지 만 가로 모드에서도 버튼이 숨겨져 있지 않다. –