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

  • Home
  • SEARCH
  • 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 9205867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:03:44+00:00 2026-06-18T00:03:44+00:00

I have a strange behavior with my buttons that I add to a scrollview.

  • 0

I have a strange behavior with my buttons that I add to a scrollview.

    for (UIView *subview in self.scrollView.subviews) {
        [subview removeFromSuperview];
    }
    //Create and place info Button(s)
    for (int i = 0; i < BigPictures.count; i++) {
        UIButton *infoButton = [[UIButton alloc] initWithFrame:CGRectMake(scrollView.frame.size.width*(i+1) - 29 - 5 - 10, scrollView.frame.size.height - 29 - 5, 29, 29)];
        [infoButton addTarget:self action:@selector(flip) forControlEvents:(UIControlEvents)UIControlEventTouchUpInside];
        //[infoButton setEnabled:YES];
        //[infoButton setUserInteractionEnabled:YES];

        [self.scrollView addSubview:[FrontViews objectAtIndex:i]];
        [infoButton setBackgroundImage:[UIImage imageNamed:@"btn_image-info.png"] forState:UIControlStateNormal];
        [scrollView addSubview:infoButton];

BigPictures contains all images I want to show in the scrollview.
Now to the odd thing. If BigPictures contains 1 image then the action (flip) is called. As soon as [BigPictures count] > 1 then the button on the first image is not executing the action but all other buttons (page 2-n) are. So how can this be??

Even if I change for (int i = 0; i < BigPictures.count; i++) with for (int i = 0; i < 1; i++) then the button is working.

So what am I missing? Already tried things like

scrollView.delaysContentTouches = NO;
scrollView.canCancelContentTouches = NO;

but latter one disables scrolling of scrollview.

EDIT:
I tried placing other buttons at different positions and none of them work on the first page (if pages > 1). Also tried to place a GestureRecognizer. This works but if ([touch.view isKindOfClass:[UIButton class]]) is not detecting a button underneath. All works fine on the other pages in scrollview. Really weird.

  • 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-18T00:03:45+00:00Added an answer on June 18, 2026 at 12:03 am

    Did a complete rebuild and now it works. Really strange because I used the exact same code.

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

Sidebar

Related Questions

I have a horizontal animated menu that has a strange behavior because it works
Its very strange behavior that I'm facing. I have delete button, OnClick I'm attaching
I have a simple HTML (as HTA) application that shows strange behavior on Windows
I have realy strange behavior. I have this code (I remove unrelated code). $(function()
I have this strange behavior in my JSP page: I have two Integer variables
I have some strange behavior redirecting stdout and stderr from s3cmd. For example: $
I have a strange behavior with my WPF ListView Control. ListViews ItemSource is Observable
I have trouble with strange behavior of for..in cycle in JavaScript. I have the
I have a very strange behavior with Request.Form . Here are two IIS 7
I have a really strange behavior with highchart (via rails plugin): The graph display

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.