我通過XIB創建了一個UIScrollVIew(name-helpView),大小爲(768,1800)。 現在我通過下面的代碼將其添加到另一個視圖。UIScrollView在縱向模式和橫向模式下的行爲不同
-(IBAction)showHelpView:(UIButton *)sender{
if(helpViewIsShowing==NO){
//set the content size more than the view size to make the view scroll
helpView.contentSize = CGSizeMake(helpView.frame.size.width, 2200);
[self.view addSubview:helpView];
helpButton.selected=YES;
helpView.backgroundColor=[UIColor whiteColor];
helpView.frame=CGRectMake(0, 41, helpView.frame.size.width, helpView.frame.size.height);
helpViewIsShowing=YES;
}
else{
[helpView removeFromSuperview];
helpButton.selected=NO;
helpViewIsShowing=NO;
}
}
當我在縱向模式運行它滾動視圖的幀出現細。 Itz也工作得很好,如果我把設備從肖像轉到景觀。但是,如果我在橫向模式下運行代碼,那麼scrollview的框架不會將其自身調整爲全屏大小。我還通過XIB提供了一個自動調整大小的遮罩。但是也沒有運氣。 任何人都可以幫助我這個請... .... Thanku
請檢查連接contentSize滾動視圖,當它在景觀開始,看看你是否需要它的人。 – visakh7 2011-03-14 11:23:12
實際上,當我處於橫向模式時,我通過給它一個不同的框架來檢查它。但即使這似乎沒有工作。 – 2011-03-14 11:27:45