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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:22:30+00:00 2026-06-04T09:22:30+00:00

I am having an issue with TTImagViews inside UIScrollview. I searched high and low,

  • 0

I am having an issue with TTImagViews inside UIScrollview. I searched high and low, but coul’dnt really find a solution. Interestingly, the tap gesture works on the last TTImageview inside the scrollview. For instance i have 10 images, that the user can scroll and the touch gesture works only on the 10th image on page 2 or rather, the last image. This is my code; any suggestions?

 UIScrollView *imageScroll=[[UIScrollView alloc] initWithFrame:CGRectMake(70, postMessageLabel.frame.size.height+10, 250, 78)];
    [imageScroll setContentSize:CGSizeMake(70 * ([[images objectAtIndex:0]count])+10,64)];        
    int startAtX=5;
    for(int i=0;i<[[images objectAtIndex:0]count];i++){
        if([[GlobalFunctions sharedGlobalFunctions] isValidURL:[[images objectAtIndex:0] objectAtIndex:i]]){
            TTImageView *imageView=[[TTImageView alloc] initWithFrame:CGRectMake(startAtX, 5, 64, 64)] ;
            imageView.userInteractionEnabled=YES;  
            [imageView addGestureRecognizer:thumbnailTap];                 
            imageView.urlPath=[[images objectAtIndex:0] objectAtIndex:i];
            imageView.autoresizesToImage=NO;
            imageView.defaultImage=nil;
            imageView.delegate=self;    
            [imageView setBackgroundColor:[UIColor blackColor]];
            [imageScroll addSubview:imageView];
            [imageView release];

        }
            startAtX+=70;            
    }

    [imageScroll setBounces:YES];
    [imageScroll setDelaysContentTouches:YES];
    [imageScroll setCanCancelContentTouches:NO];
    [self.view addSubview:imageScroll];
    [imageScroll release];

And yeah, the tap gesture works perfectly if there is only one ttimageview inside the uiscrollview. I have no clue why!

  • 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-04T09:22:31+00:00Added an answer on June 4, 2026 at 9:22 am

    Well, Looks’ like there is nothing wrong with my code; the only difference is how i am attaching the gesture recognizer. Even though i fixed i am not sure about why it went wrong. This is what happened

    1. I have declared a gesture recognizer in my viewdidload with the typical alloc init.
    2. Hence, i assumed, the gesture recognizer is available througout the view. I just kept adding it to a loop of images.

    Step 2; seemed to be the problem. The problem went away when i declared a gesture recognizer for each and every image and released it after assigning it.

    So technically for each image

    ---Create a gesture recognizer
       |-Attach it to the TTImageView
    ---Release the gesture recognizer
    

    That solved the problem. But am still curious, why the gesture recognizer works when assigned to a single and image and fails when i assign it to multiple imageviews.

    Thanks Abdullah for trying, but your solution got me nowhere.

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

Sidebar

Related Questions

Having an issue here that I have tried everything I can think of but
Having an issue with traversing in jQuery.. hopfully an easy one..but I'm banging my
I am having issue with loading test.xml and test.properties inside the same folder conf.
I have a primefaces dataList within a primefaces dataGrid but I'm having issue mapping
I'm following Railscasts Episode #165 Edit Multiple but having issue where when I go
i'm trying to create an application using three20 but i'm having issue to set
I having issue that content assistant / intellisense is working in methods such as
i am having issue with loading my selector via a jquery ajax load call
Having an issue with random individuals trying to access an intranet site with a
having same issue, i am totally new in php. i install XAMPP then download

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.