제가 알 수 있듯이 가로로 사용하면 문제가 발생하지 않습니다. 물론 코드를 시험하지 않았으므로 어떤 약속도 할 수 없습니다.
내가 상상 한 문제는 회전 후에 센터 버튼이 중앙에 오지 않는다는 것입니다. 나는이 문제를 해결하는 가장 쉬운 방법은 위의 코드는 button
는 인스턴스 변수라고 가정 다음 코드
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
CGFloat heightDifference = buttonImage.size.height - self.tabBar.frame.size.height;
if (heightDifference < 0) {
button.center = self.tabBar.center;
} else {
CGPoint center = self.tabBar.center;
center.y = center.y - heightDifference/2.0;
button.center = center;
}
}
함께 추측한다. 더 멋진 일을 수행하려는 경우 같아요
, 당신은 다음과 같은 방법 오버라이드 (override) :
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
을하고 버튼의 중심에 애니메이션,하지만 난 그 코드를 제공하지 않을거야.
제공된 코드를 실행하지 않았지만 작동해야한다고 생각합니다. 그렇지 않다면 의견을 남겨주세요. 개선을 위해 내가 할 수있는 일을 알게 될 것입니다.