正常にロードされ、正常に表示され、すべてが正常に実行される UIScrollview があります。次に、別のビュー コントローラーをプッシュし、VC2 と呼びます。これも問題なく動作します。VC2 から UIScrollview に戻るためにポップすると、ここに奇妙な動作があります... UIScrollview が戻ってくると、上から最初の (推測している) 300 ピクセルが切り取られます。ページをプルダウンしてもコンテンツは表示されますが、明らかにうまくいきません。誰にも考えはありますか?
コードは次のとおりです。
これはScrollViewを作成しています:
-(IBAction)startNewSearch:(id)sender
{
NewSearch *VCscrollView = [[NewSearch alloc] init];
[[self navigationController] pushViewController:VCscrollView animated:YES];
}
ScrollView
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
scrollView.contentSize = CGSizeMake(320, 890);
[scrollView setContentOffset:CGPointMake(0, 0) animated:NO];
[scrollView flashScrollIndicators];
}
-(void)viewWillAppear:(BOOL)animated
{
scrollView.frame = CGRectMake(0, 0, 320, 890);
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
ScrollView 内から VC2 を呼び出す IBAction:
-(IBAction)previewSearch:(id)sender
{
VCcontactServer *VC2 = [[VCcontactServer alloc] init];
[[self navigationController] pushViewController:VC2 animated:YES];
}