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 7873319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:28:37+00:00 2026-06-03T02:28:37+00:00

Please excuse poor code atm, just trying to get it working before making it

  • 0

Please excuse poor code atm, just trying to get it working before making it look nice. So I am trying to get UIScrollView working. If I remove all scroll view stuff, I have a nicely laid out page with 64 buttons, 32 on each side of the page. These buttons are nigh miniature; so I wanted to implement zoom to be able to click them.

Zoom currently has unexpected results. When the page starts, it is blank. Zooming unexpectedly shows some of the left side of the graph on the rigght side of the page, and it bounces as I try to scroll over towards it. But when I zoom more, it allows me to scroll more towards the middle of the buttons. Always giving me difficulties/bugging out as I scroll/zoom. So obviously unusable.

My viewDidLoad:

[super viewDidLoad];
UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
scroll.minimumZoomScale = 0.5;
scroll.maximumZoomScale = 3.0;
scroll.delegate = self;
    CGFloat yOrigin = self.view.frame.size.width;
    UIView *awesomeView = [[UIView alloc] initWithFrame:CGRectMake(yOrigin, 0, self.view.frame.size.width, self.view.frame.size.height)];

// iterate over values in the staff array
int heightBetweenBrackets = 0;
int widthBetweenBrackets = 0;
int heightFromTop = 45;

for(int i = 0; i < 64; i++)
{
    if(i == 32)
    {
        heightBetweenBrackets = 0;
    }
    UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    myButton.frame = CGRectMake(
                                0 + i/32*438,
                                heightFromTop + i%32*3+ heightBetweenBrackets, 
                                35, 6);
    [myButton setTitle:[NSString stringWithFormat:@"%d",i] forState:UIControlStateNormal];
    myButton.titleLabel.adjustsFontSizeToFitWidth = YES;
    [myButton.titleLabel setFont:[UIFont fontWithName:@"Arial" size:7]];
    myButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    //   [myButton addTarget:self action:@selector(chooseWinner:) forControlEvents:UIControlEventTouchUpInside];
    [awesomeView addSubview:myButton];
    heightBetweenBrackets += (i%2  -1 * -1) * 3;
}

[scroll addSubview:awesomeView];
scroll.contentSize = CGSizeMake(self.view.frame.size.width, self.view.frame.size.height);
[self.view addSubview:scroll];

and:

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
    return self.view;
}

I apologize if the bug is stupid I’m just learning IOS =] thanks for your time

EDIT: Figured it out.

For anybody in the future: I ported over a pagination scroller, and didn’t realize I had kept CGFloat yOrigin = self.view.frame.size.width; — this of course was starting the view directly to the right of any visible space. Thus I was able to zoom and see the left of it, in a buggy manner, although it started out blank. Simply changing this to 0 solved my problem.

  • 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-03T02:28:38+00:00Added an answer on June 3, 2026 at 2:28 am

    For anybody in the future: I ported over a pagination scroller, and didn’t realize I had kept CGFloat yOrigin = self.view.frame.size.width; — this of course was starting the view directly to the right of any visible space. Thus I was able to zoom and see the left of it, in a buggy manner, although it started out blank. Simply changing this to 0 solved my problem.

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

Sidebar

Related Questions

Please excuse me, today is my first day trying to setup a CI environment
First time poster, so please excuse any stupidity. I'm working on porting a custom
please excuse the Rail noob question. I'm trying to display a list of associated
Please excuse my english, I'm still trying to master it. I've started to learn
Please excuse the newbie code, im new. Any coding tips are much appreciated as
Please excuse the stupid question, but I'm working on a game because I'm crazy
I have never used memcache before now so please excuse my inexperience. Although it
Please excuse any mistakes in terminology. In particular, I am using relational database terms.
Please excuse me if I'm simple here, I want to create a simple widget
Please excuse the noob-ish nature of this question. I have a project in which

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.