2012-03-07 4 views
0

스크롤보기에 두 가지 문제가 있습니다.회전 할 때 표시되지 않는 UIScrollView의 표시

(1) 내 스크롤보기를 회전하면 스크롤보기의 표시기가 사라집니다. 회전 할 때 setFrame, setContentSize 및 setContentOffset을 호출합니다. 스크롤 뷰에 많은 하위 뷰가 있으므로 콘텐츠 크기가 작지 않습니다. 회전 할 때 모든 내 테이블보기가 좋습니다.

(2) 내 앱은 사용자의 읽기 위치를 복원 할 수 있습니다. 그래서 스크롤 뷰의 contentOffset을 CGPoint로 저장합니다. contentOffset을 복원하기 위해 setContentOffset을 호출하면 스크롤 뷰의 표시기가 사라집니다. 그러나보기가 나타나면 contentOffset 값을 (0.0, 0.0)으로 설정하면 스크롤보기의 표시기가 사라지지 않습니다. scrollRectToVisible을 사용하려고했습니다 : animated : 결과는 동일합니다.

저는 오늘이 문제로 10 시간 이상을 보냈습니다. 도와주세요 ~.

// 회전

UIScrollView *scrollViewBoard = [ [ UIScrollView alloc ] initWithFrame: CGRectZero ]; 
[ scrollViewBoard setShowsHorizontalScrollIndicator: NO ]; 
[ scrollViewBoard setAlwaysBounceVertical: YES ]; 
[ scrollViewBoard setDelegate: self ]; 
[ self addSubview: scrollViewBoard ]; 
_board = scrollViewBoard; 
[ scrollViewBoard release ]; 

// 부분을 생성하는 부분

- (void) adjustLayout: (UIInterfaceOrientation)anOrientation { 

MyTrackLog(); 
switch (anOrientation) { 
    case UIInterfaceOrientationPortrait: 
    case UIInterfaceOrientationPortraitUpsideDown: { 
     [ _board setFrame: RECT_PORTRAIT_BOARD ]; 
    } break; 
    case UIInterfaceOrientationLandscapeLeft: 
    case UIInterfaceOrientationLandscapeRight: { 
     [ _board setFrame: RECT_LANDSCAPE_BOARD ]; 
    } break; 
    default: 
     break; 
} 
[ _board setContentSize: [ self calculateContentSize: anOrientation ] ]; 
[ _board setContentOffset: _contentOffset ]; 
[ self arrangeAchievementButtons: anOrientation ]; 

} // adjustLayout :

감사합니다.

답변

0

아마도 UIScrollView이 디스플레이를 확장합니다.
시도해 볼 수 있습니다.

UIScrollView의 수퍼 뷰는 autoResizeSubViews에서 YES으로 설정해야합니다. UIScrollViewautoResizingMask에서 UIViewAutoResizingFlexibleWidth | UIViewAutoResizingFlexibleHeight으로 설정해야합니다.
방향 전환 후 크기 조정에 setFrame을 사용하지 마십시오.

+0

시도해 보겠습니다. 고맙습니다. – MonsterK

0
[_board flashScrollIndicators]; 

방향을 변경 한 후에.

관련 문제