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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:15:25+00:00 2026-06-05T06:15:25+00:00

I have a scroll view that contains image view sized 68×78: As you could

  • 0

I have a scroll view that contains image view sized 68×78:

enter image description here

As you could see, all that images except from the centered one have a shadow. It changes when user scrolls, center image is always clear. It goes perfect until for the left edge image:

enter image description here

Here is the code:

-(void) buildSlideView{

    fotosJugadores = [[NSArray alloc] initWithObjects:@"cara5.png", @"cara7.png", @"cara8.png", @"cara9.png", @"cara11.png", @"cara13.png", @"cara14.png", @"cara15.png", @"cara18.png",@"cara19.png", @"cara20.png", @"cara32.png",@"cara44.png",@"cara51.png", @"cara100.png", @"cara101.png", @"cara102.png",@"cara103.png", @"cara104.png", @"cara105.png",@"cara106.png",@"cara107.png", nil];

    numberOfViews = [fotosJugadores count];

    for (int i = 0; i <    [fotosJugadores count]; i++) {

        UIImage *myImage = [UIImage imageNamed:[fotosJugadores objectAtIndex:i]];
        CGFloat yOrigin = i * (myImage.size.width+3) + 120;
        UIImageView *awesomeView = [[UIImageView alloc] initWithFrame:CGRectMake(yOrigin, 0, myImage.size.width, myImage.size.height)];
        awesomeView.tag = i;
        awesomeView.image = myImage;
        awesomeView.alpha = 0.5f;
        awesomeView.backgroundColor = [UIColor blackColor];
        [self.jugadorSlide addSubview:awesomeView];
        awesomeView=nil;

    }

    [jugadorSlide setBackgroundColor:[UIColor blackColor]];
    jugadorSlide.contentSize = CGSizeMake(68 * numberOfViews+240,78);
    jugadorSlide.layer.cornerRadius = 11;
    jugadorSlide.layer.masksToBounds = YES;
    [jugadorSlide setContentOffset:CGPointMake(((68 * numberOfViews)/2), 0)];
    //jugadorSlide.decelerationRate = UIScrollViewDecelerationRateNormal;
    [self scrollViewDidEndDragging:jugadorSlide willDecelerate:NO];

}

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
    currentIndex = roundf(scrollView.contentOffset.x / 68);
    NSLog(@"current end %d", currentIndex);
    UIImageView *currentImage = [scrollView viewWithTag:currentIndex];
    if (currentIndex>0&&currentIndex<=21){
         if (currentIndex==currentImage.tag){
            currentImage.alpha=1.0f;
            [self changePerfilImage:currentImage.tag];}
             CGPoint pointZero= CGPointMake(scrollView.contentOffset.x, currentImage.frame.origin.y);
            [jugadorSlide setContentOffset:pointZero animated:YES];

    }else {
            UIImageView *currentImage = [scrollView viewWithTag:0];
            NSLog(@"end dragging image tag %d", currentImage.tag);
            currentImage.alpha=1.0f;
            [self changePerfilImage:currentImage.tag];}
            CGPoint pointZero= CGPointMake(currentImage.frame.origin.x+15, 0);
            //[jugadorSlide setContentOffset:pointZero animated:YES];

}

As you can see, in the scrollViewDidEndDragging: “else” , I forced the tag as a desesperate solution, but images doesn’t get clear.

  • 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-05T06:15:27+00:00Added an answer on June 5, 2026 at 6:15 am

    You are incrementing the tag twice…

    awesomeView.tag = i++;
    

    Should just be:

    awesomeView.tag = i+1;
    

    I use i+1 because I never use a tag of 0 since any subview that hasn’t been assigned a tag will have a tag of 0.

    - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
        NSInteger currentIndex = roundf(scrollView.contentOffset.x / 68.0) + 1;
        UIImageView *currentImage = [scrollView viewWithTag:currentIndex];
        ...
    }
    

    If this doesn’t work you should NSLog the currentIndex each time you land on a new image and see what is happening when you land on the first one.

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

Sidebar

Related Questions

(iOS) I have a view that contains multiple textviews under static headings (see image
I have applied scroll view to the entire layout and that layout has one
I have a scroll view with transparent background that covers most of the screen.
I have UIScrollView in my view. Problem is that if I slightly scroll it
I have a scroll view which has one UIView inside which contains the content.
I have an array of Image URl's from that array i have displayed my
I' have a view that contains several textViews an ImageView and a Button .
I have an app written in XUL which contains a custom tree view that
I have a UIScrollView on screen. Scroll view contains a view in which are
I have a UIScroll View that scrolls vertically, each cell contains a UIScrollView that

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.