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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:35:18+00:00 2026-06-03T22:35:18+00:00

I’m trying to implement a uiscrollview with small images. I need that uiscrollview last

  • 0

I’m trying to implement a uiscrollview with small images.

  1. I need that uiscrollview last image in every end remain in the center when scroll finishes, leaving one side empty. Now last image remain in the sides when scroll finishes.

  2. I need to know which image is in the center of the scollview, to apply a shadow on it,

    jugadorSlide.pagingEnabled = YES;
    NSError *error = nil;
    fotosJugadores = [[NSFileManager defaultManager] contentsOfDirectoryAtPath: @"/Users/exular/Developer/GBC/exular/GBC/Caras/" error: &error];
    
    NSInteger numberOfViews = [fotosJugadores count];
    for (int i = 0; i < numberOfViews; i++) {
    
        UIImage *myImage = [UIImage imageNamed:[fotosJugadores objectAtIndex:i]];
        CGFloat yOrigin = i * myImage.size.width;
        UIImageView *awesomeView = [[UIImageView alloc] initWithFrame:CGRectMake(yOrigin, 0, myImage.size.width, myImage.size.height)];
        awesomeView.alpha = 0.5;
        awesomeView.image = myImage;
        [self.jugadorSlide addSubview:awesomeView];
        awesomeView=nil;
    }
    jugadorSlide .contentSize = CGSizeMake(65 * numberOfViews,78);
    jugadorSlide.layer.cornerRadius = 11;
    jugadorSlide.layer.masksToBounds = YES;
    

Many thanks for your help.

  • 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-03T22:35:20+00:00Added an answer on June 3, 2026 at 10:35 pm

    To allow the first and last image to be in the center just add an empty space before the first image and after your last image. In other words: start your yOrigin at 65 and add 65 to the contentSize width (I am assuming that 65 is your images width):

    ...
    CGFloat yOrigin = i * myImage.size.width + 65;
    ...
    jugadorSlide.contentSize = CGSizeMake(65 * numberOfViews + 65,78);
    ...
    

    To find out which image is in the center add the following inside the UIScrollViewDelegate method scrollViewDidEndDecelerating:.

    - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
        int currentIndex = roundf(scrollView.contentOffset.x / 65) - 1;
        UIImageView *currentImage = [scrollView viewWithTag:currentIndex];
    }
    

    To easily get the currentImage, add tags to your images when you create them:

    ...
    awesomeView.tag = i;
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

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.