だから私はこれに関する他の多くの投稿を見てきました、そして私はそれらのほとんどすべてを試したと思います. これを重複させたくないのですが、問題を解決できません。私は次のような設定をしています:
Scroll View Controller に到達すると、問題なくページオーバーできますが、画像を垂直方向に移動することもできます。それは、NavigationBar が ScrollView フレームを強制的に下げているのに、フレームが全画面サイズに設定されていることに関係していると思います。Scroll View View Controllerで垂直スクロールを防ぐにはどうすればよいですか? 私の.mは以下です:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.navigationController.navigationBarHidden = NO;
i = 0;
_PhotoBundle = [[NSBundle mainBundle] pathsForResourcesOfType:@".jpg"inDirectory:@"Dog_Images"];
_PhotoArray = [[NSMutableArray alloc] initWithCapacity:_PhotoBundle.count];
for (NSString* path in _PhotoBundle)
{
[_PhotoArray addObject:[UIImage imageWithContentsOfFile:path]];
}
for (int x = 0; x < _PhotoArray.count; x++)
{
CGRect frame;
frame.origin.x = self.mainScroll.frame.size.width * x;
frame.origin.y = 0;
frame.size = self.mainScroll.frame.size;
UIImage *nextImg = [[UIImage alloc] init];
nextImg = [_PhotoArray objectAtIndex:x];
UIImageView *nextIV = [[UIImageView alloc] initWithFrame:frame];
[nextIV setImage:nextImg];
[self.mainScroll addSubview:nextIV];
//NSLog(@"Pass %d", x);
}
self.mainScroll.contentSize = CGSizeMake(self.mainScroll.frame.size.width * _PhotoArray.count, self.mainScroll.frame.size.height);
}
どうもありがとうございました!!