Iphone 水平滚动图像的最佳方式

Iphone 水平滚动图像的最佳方式,iphone,image,sdk,horizontal-scrolling,Iphone,Image,Sdk,Horizontal Scrolling,在iphone sdk中水平滚动图像的最佳方式是什么。必须从web服务器获取图像,比如延迟加载 请帮帮我。以下是我的建议: 首先,为UIScrollView设置固定大小 scroll.size = ... // your size 接下来,确定滚动条内容大小的宽度和高度。固定高度。宽度是可更改的值。成功加载每个惰性图像后,调整宽度 假设所有图像都具有相同的高度。然后,每次加载图像时,代码为: (在下面的代码中,我假设添加了新映像。在您的情况下,您可以根据需要进行适当配置) 您好@Sathish

在iphone sdk中水平滚动图像的最佳方式是什么。必须从web服务器获取图像,比如延迟加载

请帮帮我。

以下是我的建议:

首先,为UIScrollView设置固定大小

scroll.size = ... // your size
接下来,确定滚动条内容大小的宽度和高度。固定高度。宽度是可更改的值。成功加载每个惰性图像后,调整宽度

假设所有图像都具有相同的高度。然后,每次加载图像时,代码为:

(在下面的代码中,我假设添加了新映像。在您的情况下,您可以根据需要进行适当配置)


您好@Sathish如果您有任何关于您的问题的解决方案,请在这里分享您的解决方案,因为它可能对其他人也有帮助,我也需要它,所以请分享!!请
float oldScrollWith = scroll.contentSize.width
// creat new_image_view (UIImageView)
// configure it to display in the scroll
...                       
new_image_view.frame = CGRectMake(oldScrollWidth, 0, imageViewWidth, fixed_image_height)

// append the new view to the scroll
float newScrollWidth = oldScrollWidth + new_image_view.frame.size.width // re-calculate the width for the contentSize of scroll
scroll.contentSize = CGSizeMake(newScrollWidth, fixed_image_height);
[scroll addSubview:new_image_view];