我所拥有的是图像列表。我在启用分页的scrollview中显示了这些图像。
现在,客户再次要求显示下一张(部分可见),当前(完全可见)和上一张(部分可见)图像,如下图所示。
(来源:mzstatic.com)
我尝试过的如下。
int mm = 150;
for (int i=0;i<featuredProductArray.count;i++) {
UIButton *mButton = [UIButton buttonWithType:UIButtonTypeCustom];
[mButton addTarget:self action:@selector(takeMeToProductDetails:) forControlEvents:UIControlEventTouchUpInside];
mButton.imageView.contentMode = UIViewContentModeScaleAspectFill;
[mButton sd_setImageWithURL:[NSURL URLWithString:[[[featuredProductArray objectAtIndex:i] valueForKey:@"Image"] stringByReplacingOccurrencesOfString:@"/Original/" withString:@"/1080/"] ] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"slider_bg.png"]];
[mButton setAdjustsImageWhenHighlighted:NO];
mButton.accessibilityValue = [NSString stringWithFormat:@"feat%d", i];
mButton.frame = CGRectMake(mm*iPhoneFactorX, 0, 780*iPhoneFactorX, iPhoneHeight-(20+(149*iPhoneFactorX)));
mm = mm + 780+50;
[yScrollView addSubview:mButton];
}
现在我有页面调度问题..当我滚动时,第二个图像未居中...