2016-10-25 2 views

답변

0

didRotateFromInterfaceOrientation 방향 위임 메서드를 추가하여 사용하십시오. 레이아웃 파단으로

UIView documentation에서 UIViewautoresizingMask 재산,

처럼,

YourView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 

를 사용

은 뷰의 경계 변화는, 해당 뷰가 자동으로 따라 그 서브 뷰의 크기를 조정하는 경우 각 하위 뷰의 자동 크기 조정 마스크

layoutSubviews를 트리거 None 이외의 autoresizingMask 변경.

따라서 아래 코드를 사용하여 didRotateFromInterfaceOrientation 대리자 메서드를 사용하여 하위 뷰를 배치 할 수 있습니다.

-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { 

    [self.view layoutIfNeeded]; 
    [self.view setNeedsLayout]; 
    self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 

    //....Other code 
} 


-(void)layoutSubviews{ 

    //write your code to draw here 
}