UIScrollView
ポートレートモードでxibファイルを使用しています。アプリケーションを実行し、デバイスを横向きモードに回転すると、新しい境界が表示されますUIScrollView
。UIScrollView
下部の内部のコントロールの半分はアクセスできません。スクローラーは表示されません。
UIScrollView
デバイスの向きが変更された後の縦サイズの変更を防ぐ方法は?
助けてくれてありがとう!
UIScrollView
ポートレートモードでxibファイルを使用しています。アプリケーションを実行し、デバイスを横向きモードに回転すると、新しい境界が表示されますUIScrollView
。UIScrollView
下部の内部のコントロールの半分はアクセスできません。スクローラーは表示されません。
UIScrollView
デバイスの向きが変更された後の縦サイズの変更を防ぐ方法は?
助けてくれてありがとう!
shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(interfaceOrientation == UIInterfaceOrientationPortrait)
{
//set frame for scroll in portrait mode
}
else if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft)
{
//set frame for landscape
}
}
編集: UIScrollViewを選択し、このようにスクロールビューのautoresizeプロパティを変更します。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
{
//change sub view of scrollview accordingly to orientation
if(UIInterfaceOrientationIsPortrait(interfaceOrientation))
yourScrollView.frame = CGRectMake(0,0,320,460);
yourScrollView.contentSize = CGSizeMake(320,460);//change accordingly
else
yourScrollView.frame = CGRectMake(0,0,480,300);
yourScrollView.contentSize = CGSizeMake(480,460); //change accordingly
return YES;
}
UIScrollViewを選択し、プロパティからサイズインスペクターをクリックして、ビューの自動サイズ変更プロパティを変更します。
コードを使用します:
scrollView.contentSize = CGSizeMake(width、height);
UIScrollView のフレームを変更します
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
デバイスの回転に応じて。