試試這個代碼//未測試
EDITED
let percentage = (self.collectionview.contentOffset.x * 100)/(self.collectionview.contentSize.width - self.collectionview.frame.size.width)
let rightCorner = (self.collectionview.frame.size.width * percentage)/100
yourview.frame.origin.x = rightCorner
yourview.frame.origin.x -= yourview.frame.size.width
EDIT 9月4日
添加以下代碼- (void)scrollViewDidScroll:(UIScrollView *)scrollView
if ([self.view viewWithTag:500000]) {
[[self.view viewWithTag:500000] removeFromSuperview];
}
CGFloat xPos = ((scrollView.contentOffset.x)/(scrollView.contentSize.width - scrollView.frame.size.width)) * (scrollView.frame.size.width - 112) ;
UIView *view = [UIView new];
view.tag = 500000;
[view setFrame:CGRectMake(xPos ,self.collectionViewFrames.frame.origin.y + self.collectionViewFrames.frame.size.height, 112, 25)];
[view setBackgroundColor:[UIColor redColor]];
[self.view addSubview:view];
[self.view bringSubviewToFront:view];
@hemange可以爲您提供一些代碼,我看到並能有所幫助 –