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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:27:03+00:00 2026-05-27T13:27:03+00:00

I am trying to create a options button above my scroll view that will

  • 0

I am trying to create a options button above my scroll view that will allow the user to press it and have something happen.

Currently I have a map that is scrollable but if you pinch to zoom it zooms everything including the button.. where in actuality I would like to have the button stay as at its original size in its original position.

I think I have to make a new view for this to happen but if i do that I will not be able to control the scroll view… so I was wondering if anyone knows how I can manage this?

here is my code and some images of what is happening

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    //Create Scrollview
    scrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
    scrollView.backgroundColor = [UIColor blackColor];
    scrollView.delegate = self;
    scrollView.bounces = NO;

    //Create Scrolled image
    backgroundImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"auckland-300.jpg"]];
    image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"249a-134206f1d00-1342071f5d9.ImgPlayerAUCKLAND.png"]];

    //Initalize Button Programatically
    playButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [playButton addTarget:self 
                   action:@selector(sendHttpsRequest)
         forControlEvents:UIControlEventTouchDown];
    [playButton setTitle:@"Show View" forState:UIControlStateNormal];
    playButton.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);


    // Note here you should size the container view appropriately and layout backgroundImage and image accordingly.
    containerView = [[UIView alloc] initWithFrame:CGRectMake(0,0,601,601)];

    //Add subviews to container
    [containerView addSubview:backgroundImage];
    [containerView addSubview:image];

    //Initalize views
    scrollView.contentSize = containerView.frame.size;
    [scrollView addSubview:containerView];
    [scrollView addSubview:playButton];

    //Scrolling
    scrollView.minimumZoomScale = 0.5;
    scrollView.maximumZoomScale = 31.0;
    [scrollView setZoomScale:scrollView.minimumZoomScale];
    self.view = scrollView;    


}

enter image description here

enter image description here

Solution:

//Initalize views
    scrollView.contentSize = containerView.frame.size;
    [scrollView addSubview:containerView];

    //Scrolling
    scrollView.minimumZoomScale = 1.0;
    scrollView.maximumZoomScale = 31.0;
    [scrollView setZoomScale:scrollView.minimumZoomScale];

    //Set up Highrachys
    [self.view addSubview:scrollView];
    [self.view addSubview:playButton];
  • 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-05-27T13:27:03+00:00Added an answer on May 27, 2026 at 1:27 pm

    Don’t set self.view to the scroll view. Add the scroll view as a subview of self.view instead, and add your button as another subview of self.view.

    At the moment your button is a subview of the scroll view, so any scrolling action is also applying to the button, as you have seen. The button needs to be in a separate branch of the view hierarchy.

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

Sidebar

Related Questions

I am trying to create a trapezoid using user inputted options. I know my
I have a popup I want to create that will have 3 choices. (Block,
I am trying to create a simple dialog box to allow my user to
I'm new to Core Data. I'm creating an app that will allow a user
I am trying to create a UIAlertView that has 3 options and no cancel
I have a pop up button that is loaded with 5 options programicically, if
I'm trying to create a div that would have a dynamic width depending on
I'm trying to create an options menu in a C# forms project, and I'm
I am trying create a WCF service that leverages the WPF MediaPlayer on the
Trying to create a user account in a test. But getting a Object reference

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.