저는 객관적인 -c 및 iPhone 개발에 익숙하지 않지만 지금까지는 더 깊이 파고들 때까지 모든 것이 잘 진행되고있었습니다. 내 문제는 다른 방향에 대한 특정 좌표로 특정 UIView 하위 클래스를 초기화 할 수 없다는 것입니다.iphone UIView 하위 클래스가 요청에 따라 초기화되지 않았습니다.
회전이 잘 작동하지만 앱이 초기화 될 때 문제가 발생합니다. 다른 방향으로 다른 레이아웃을 제공 할 생각이었습니다.
내 앱은 실제로 기본 UIViewController와 3 개의 하위 뷰 (UIView)가있는 iPad 앱입니다. view1, view2 및 view3을 호출 할 수 있습니다.
프로젝트의 펜촉에 세 개의보기가 생성되고 콘센트가 코딩되어 연결됩니다.
문제가있는 viewDidLoad 메서드에서 생성 될 것으로 보인다... 그것은 현재 다음과 같습니다
-(void)viewDidLoad{
[super viewDidLoad];
[view1 removeFromSuperview];
[view2 removeFromSuperview];
[view3 removeFromSuperview];
UIInterfaceOrientation curOrientation = self.Orientation;
if(curOrientation == UIInterfaceOrientationPortrait)
{
view1 = [[XView alloc] initWithFrame:CGRectMake(20,492,728,492)];
view2 = [[YView alloc] initWithFrame:CGRectMake(384,20,364,472)];
view3 = [[ZView alloc] initWithFrame:CGRectMake(20,20,364,472)];
[self.view addSubview:view1];
[self.view addSubview:view2];
[self.view addSubview:view3];
}
else if(curOrientation == UIInterfaceOrientationLandscapeRight)
{
//Different coordinates
}
else if(curOrientation == UIInterfaceOrientationLandscapeLeft)
{
//Different Coodinates
}
}
내 문제의 의견이있는 viewDidLoad 방법에 주어진 것과 같은 좌표를 얻고 있지된다는 것입니다 그들은 x = 0, y = 0에서 초기화되는 것처럼 보입니다. 그러나 장치를 회전 시키면 모든 것이 매력처럼 작동하고 각 UIView는 각 방향에 맞는 위치에 설정됩니다. 기본적으로 각 UIView setFrame 메서드를 호출합니다.
내가 잘못 여기서 뭐하는 거지 확실하지 않다.... 저 좀 도와주세요 ...
안부