UIPickerView와 도구 모음 (216 + 44)이있는 사용자 정의보기가 있습니다. 초기화 시간 (viewDidLoad)에서이 사용자 정의보기는 다음 코드를 사용하여 화면 아래로 푸시됩니다.tabBar가있을 때 이상한 위치 지정 문제
CGPoint newOrigin;
newOrigin.x = pickerViewOutlet.frame.size.width/2;
newOrigin.y = self.view.frame.size.height + ((pickerViewOutlet.frame.size.height)/2);
NSLog(@"%f,%f",self.view.frame.size.height,(pickerViewOutlet.frame.size.height)/2);
pickerViewOutlet.center = CGPointMake(newOrigin.x, newOrigin.y);
버튼을 클릭하면 다음 코드를 사용하여이보기가 표시됩니다.
[self.view bringSubviewToFront:pickerViewOutlet];
NSLog(@"tabbar %f",self.tabBarController.tabBar.frame.size.height);
CGPoint showOrigin;
showOrigin.x = pickerViewOutlet.frame.size.width/2;
showOrigin.y = pickerViewOutlet.center.y - pickerViewOutlet.frame.size.height;
//self.tabBarController.tabBar.frame.size.height ;
NSLog(@"showpicker %f,%f",pickerViewOutlet.center.y,pickerViewOutlet.frame.size.height);
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.5];
pickerViewOutlet.center=CGPointMake(showOrigin.x, showOrigin.y);
[UIView commitAnimations];
[pickerCtrlOutlet reloadAllComponents];
잘 작동합니다. 그러나 이것은 상기 코드로 변경되는 경우 코드 그러나
showOrigin.y = pickerViewOutlet.center.y - pickerViewOutlet.frame.size.height - self.tabBarController.tabBar.frame.size.height ;
같이 변형 되더라도 페이지 하부 탭 바 컨트롤러의 존재 (뷰의 일부가 탭 바 이하)를 작동하지 않는다
showOrigin.y = pickerViewOutlet.center.y - pickerViewOutlet.frame.size.height - self.tabBarController.tabBar.frame.size.height - 90;
보기가 탭 바로 위에있는 곳에서 완벽하게 작동합니다.