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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:51:35+00:00 2026-06-02T13:51:35+00:00

Please read my question before marking it as duplicate or repeat question… I have

  • 0

Please read my question before marking it as duplicate or repeat question…

  1. I have one scroleView in which I put some images in tabular form.

  2. When user click one of it the next view controller is shown and the
    clicked image’s uiview get green border.

  3. And when user navigate back to this view the clicked image is shown
    with green border. all this worked fine

But the problem starts when user clicks other images : the previously clicked image doesn’t get back to normal, ie, its border stays there even if I put its width to 0.0 and color to clearColor

Please guide me how to remove those borders

My code is as below:

for (int row = 0; row < r; ++row)
    {
        for (int col = 0; col < 2; ++col)
        {
            int index = (row * 2) + col;
            if(index < [tempArr count])
            {
                CGRect frame = CGRectMake(10+col*(10+145),10+row*(5+100),145, 100);
                UIView *fr = [[UIView alloc] initWithFrame:frame];
                CGRect imgFrame = CGRectMake(0, 0, 145, 100);
                UIImageView *imgView = [[UIImageView alloc]initWithFrame:imgFrame];
                imgView.image = [UIImage imageNamed:[[tempArr objectAtIndex:index]valueForKey:@"add"]];
                UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction:)];
                fr.layer.borderWidth = 0.0f;
                fr.layer.borderColor = [UIColor greenColor].CGColor;
                if(selctedFrame == index)//Here i put border
                {
                    fr.layer.borderWidth = 2.0f;
                    fr.layer.borderColor = [UIColor greenColor].CGColor;
                }
                else //here i remove them
                {
                    fr.layer.borderWidth = 0.0f;
                    fr.layer.borderColor = [UIColor clearColor].CGColor;
                }
                tapGesture.numberOfTapsRequired = 1;
                tapGesture.numberOfTouchesRequired = 1;
                [fr addGestureRecognizer:tapGesture]; 
                [fr addSubview:imgView];
                fr.tag = index;
                [self.scrollDisplay addSubview:fr];
                [self.scrollDisplay bringSubviewToFront:fr];
            }
        }
    }
    [self.view addSubview:self.scrollDisplay];

This method is called in viewWillAppear:animated: method

Edit

enter image description here

after some navigation forth and back

enter image description here

  • 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-02T13:51:37+00:00Added an answer on June 2, 2026 at 1:51 pm

    i just need to do is to set the border color to the background color of the view. any other options did nothing the border is not been hidden through any thing else the only work around i got is this

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

Sidebar

Related Questions

Before you say its a duplicate question, please let me explain (as I've read
Before this question is marked as duplicate, please read it. ;) There are already
Before jumping on me, please read my question carefully :D. I know there are
This question might seem a repeat of previous ones. I have read through a
Guys before you start down voting me please read this question and please understand
Before someone shouts out the answer, please read the question through. What is the
I have tried to ask a variant of this question before. I got some
Before you declare this question as a duplicate of this or that , please
Please read this entire question before you try to mark this as too controversial.
PLEASE READ THE FULL QUESTION BEFORE POST YOUR ANSWER Hello guys! I'm currently developing

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.