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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:44:20+00:00 2026-05-22T23:44:20+00:00

My question is actually simple but for better understanding I explained everything here. I

  • 0

My question is actually simple but for better understanding I explained everything here.

I have a series of UIImageView‘s inside a UIScrollView and also have another big UIImageView.

My code is like this

- (void)viewDidLoad {   

    imgScrollView.clipsToBounds = YES;      
    imgScrollView.scrollEnabled = YES;
    imgScrollView.userInteractionEnabled =YES;

    // load all the images 
    NSUInteger i;
    for (i = 1; i <= 9; i++)
    {
        NSString *imageName = [NSString stringWithFormat:@"image%d.jpg", i];

        CGRect imageViewFrame = CGRectMake(0.0f, 0.0f, kHeight, kWidth);

        // TapImage is a subclassed UIImageView that catch touch/tap events 
        TapImage *imageView = [[[TapImage alloc] initWithFrame:imageViewFrame] autorelease];
        imageView.userInteractionEnabled = YES;
        imageView.image = [UIImage imageNamed:imageName];
        imageView.tag = i;  

        [self.imgScrollView addSubview:imageView];
        [imageView release];
    }

    [self layoutImages];
    [super viewDidLoad];
}

TapImage is a subclassed UIImageView. code is like this

 @interface TapImage : UIImageView {
 }
 @end


 @implementation TapImage
 - (id)initWithFrame:(CGRect)aRect {
     if (self = [super initWithFrame:aRect]) {
         self.userInteractionEnabled = YES;
     }
     return self;
 }

 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {     
     [self.layer setBorderColor: [[UIColor greenColor] CGColor]];
     [self.layer setBorderWidth: 2.0];

     NSLog(@"Touches began %@",touches);    
 }
  1. I want to give preview in big UIImageView, when touching one image in the scroll view ( Just like the ‘Film Strip view’ feature in Windows OS ). But the problem is, bigPreview UIImageView is not accessible from TapImage class as its not part of the TapImage class. Then whats the solution here??

  2. When touching one image in the scrollView, it gets a green border (indicating as selected). Here, I want to deselect the previously touched image when we touch another image in the scrollView (means, at a time only one image gets selected and previewed ). But the problem is, when touch on it, each UIImageView calls its own touchesBegan: method. Then how to deselect the previously touched image??

Please help me with some simple and detailed answers. 🙂 Thanx in advance. 🙂

  • 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-22T23:44:21+00:00Added an answer on May 22, 2026 at 11:44 pm

    This is a perfect example of when to use a delegate method. Essentially, a delegate method allows actions in one viewController (button clicked, view tapped, etc) to trigger the methods of another.

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

Sidebar

Related Questions

Actually my question here is: are null and nil equivalent or not? I have
The question is pretty simple actually. I have a module in my system containing
Actually a simple question, but I wasn't able to find any good conclusive answer.
I have a seemingly simple question, but can't find the answer. I have a
I have a relatively simple question. Say I have a file but I only
Simple question - what does this actually do? var oq = (ObjectQuery<TEntity>)L2EQuery; return ExecuteFirstorDefault<TEntity>(oq,
Actually my question is all in the title. Anyway: I have a class and
I have a simple R beginner's question: How do I express the sum below
I am writing a simple app where I have a UIImageView that when clicked
I actually have two questions regarding the same problem but I think it is

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.