Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8772605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:04:30+00:00 2026-06-13T18:04:30+00:00

So I have seen the many other posts on this, and I think I

  • 0

So I have seen the many other posts on this, and I think I have tried almost all of them. I don’t want this to be a duplicate, but I can’t get a solution to my problem. I have a setup like this:
enter image description here

When I get to my Scroll View Controller, I can page over just fine, but I can also move the pictures around vertically. I think it has something to do with the NavigationBar forcing the ScrollView frame down, but still having the frame set to the full screen size. How do I prevent any vertical scrolling on the Scroll View View Controller? My .m is below:

- (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);

}

Thank you very much!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:04:34+00:00Added an answer on June 13, 2026 at 6:04 pm

    So I found a post that explained it perfectly:

    How to disable just vertical scrolling in a UIScrollView?

    When I change my

    CGSizeMake(self.mainScroll.frame.size.width * _PhotoArray.count, self.mainScroll.frame.size.height);
    

    to

    CGSizeMake(self.mainScroll.frame.size.width * _PhotoArray.count, 1.0);
    

    It makes the contentSize from being larger than the bounds… Something that I have read about, but did not fully understand. I hope this helps someone else who is stuck with this…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen al most all the other posts about this, but I can't
I have seen many posts on this subject, but none have been answered, and
I have seen many posts to this problem but no prescribed solution worked for
I have seen many answers for this type of question but its not related
Many posts on different aspects of this question but I haven't seen a post
I have seen many posting this issue in SO. I have gone through those
I have seen many question and applied their results but nothing happens I still
I have seen many articles about POCO. What is this?
I have seen many articles and Questions/Answers Regarding Lock Escalation but following things are
I have seen many answers on stackoverflow, but I didn't find an answer that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.