iCarousel 第一个item的位置总是在中间位置?我想让他靠左边

图片描述

- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view {
    
    if (!view) {
        view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 110, 110)];
    }
    view.backgroundColor = self.recommendDataArray[index];
    return view;
}
阅读 3.7k
1 个回答

iCarousel 有一个方法可以滚动到指定的 item 位置,视图加载完直接调用滚动到第2个或者第3个 item,第一个 item 的位置就靠左边了。

- (void)scrollToItemAtIndex:(NSInteger)index animated:(BOOL)animated;
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题