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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:14:52+00:00 2026-06-13T21:14:52+00:00

I created a UIScrollView which contains several UIImageView instances. The SDWebImage framework is used

  • 0

I created a UIScrollView which contains several UIImageView instances. The SDWebImage framework is used in order to cache images and present them in the UIImageView instances. Now I want to be able to click on these instances of UIImageView.

Previously I added UIButtons to the UIScrollView and added an image to this button. But know I am not able to add a UIImageView to a button. How should I solve this? is it an option to place an UIButton over this view? and how should I do this?

I previously used this to add clickable images (I need to change this, due to the SDWebImage framework, so I cannot use UIImage imageNamed:forState

        CGFloat y = i * self.view.frame.size.height/6; 
        UIButton* aButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [aButton setTag:[[idsCol objectAtIndex: i] intValue]];
        aButton.frame = CGRectMake(0, y, self.view.frame.size.width/3, self.view.frame.size.height/6);

        aButton.imageView.contentMode = UIViewContentModeScaleAspectFit;

        [aButton setImage:[UIImage imageNamed:@"image.jpg" forState:UIControlStateNormal];

        [aButton addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
        aButton.adjustsImageWhenHighlighted = NO;
        [scrollView addSubview:aButton];

I currently need to make the following imageview clickable:

[testImageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
               placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
  • 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-13T21:14:53+00:00Added an answer on June 13, 2026 at 9:14 pm

    I’m unfamiliar with SDWebImage, but if this framework would allow you to modify the buttons imageView property directly you’d be better off:

    [myButton.imageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"] placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
    

    Alternatively, if you want to stick with using a image view, you can make it “clickable” by adding a simple tap gesture to it:

    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(myMethod:)];
    [tap setNumberOfTapsRequired:1];
    [tap setNumberOfTouchesRequired:1];
    [testImageView setUserInteractionEnabled:YES];
    [testImageView addGestureRecognizer:tap];
    
    
    
    
    - (void)myMethod:(UIGestureRecognizer *)sender
    {
        NSLog(@"%u",sender.view.tag);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created a UIScrollView with paging containing several images, with 1 image per page,
I have a UIScrollView and a UIImageView which I have created programmatically without interface
I created a class (UIView) which has a UIScrollview inside. Through the delegate scrollViewDidEndDecelerating
I have a zooming UIScrollView that contains a UIView which contains some custom UIViews
I ve set of images (created dynamically) which are placed in a single row
I've created a UIScrollView in Interface Builder which takes up the entire screen of
I need to create a horizontal UIScrollView which to hold hundreds of thumbnail images,
I have created a UIView called ImageShowcase which has a UIScrollView and then i
I have a UIScrollView which I create and size dynamically using... scrollView.contentSize = CGSizeMake(scrollView.frame.size.width
I subclassed UIScrollView Then created an object of it in the main class. Added

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.