Q:

UIScrollview questions

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

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. 
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.

A:

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;
...

