2011-05-16 1 views

답변

0

방향에 따라보기를 배치해야하는 것처럼 들립니다. 그러나 인물 사진 및 풍경 프레임의 화면 비율이 달라집니다. 당신이보기를 레이아웃하는 방법의

예제 :

int h = 300; 
int w = 100; 
int space = 50; 

CGRect frame; 
if(interfaceOrientation == UIInterfaceOrientationPortrait) { 

    frame = CGRectMake(space, space, w, h); 
} 
else if(interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) { 
    frame = CGRectMake(self.view.bounds.size.width - w - space, self.view.bounds.size.height- h - space, w, h); 
} 
else if(interfaceOrientation == UIInterfaceOrientationLandscapeRight) { 
    frame = CGRectMake(space, self.view.bounds.size.height- w - space, h , w); 
} 
else if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft) { 
    frame = CGRectMake(self.view.bounds.size.width - h - space, space, h, w); 
} 

self.label.frame = frame; 
+0

thelaws, 덕분에이 작동합니다. 자동 크기 조정을 사용하는 것이 더 쉽다는 것을 알았습니다. 화면이 바뀌거나 사용자가 화면의 총 다시 실행보다 크기 조정 동작에 익숙하다고 생각합니다. – Eric

관련 문제