2009-08-01 99 views
0

我的漫画书应用程序已启动并正在运行,但缺少一些东西。从左到右滚动横向和addSubView

1)我想让图像从左到右滚动,但我有应用程序在打开时自动将其自动设置为横向模式。我在哪里调整这部分的应用程序?我有两个我的图像显示...我在哪里添加其他22个图像在我的代码中通过addSubView?在我的代码中添加其他22个图像通过addSubView?

// load all the images from our bundle and add them to the scroll view 
NSUInteger i; 
for (i = 1; i <= kNumImages; i++) 
{ 
    NSString *imageName = [NSString stringWithFormat:@"image%d.jpg", i]; 
    UIImage *image = [UIImage imageNamed:imageName]; 
    UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; 

    // setup each frame to a default height and width, it will be properly placed when we call "updateScrollList" 
    CGRect rect = imageView.frame; 
    rect.size.height = kScrollObjHeight; 
    rect.size.width = kScrollObjWidth; 
    imageView.frame = rect; 
    imageView.tag = i; // tag our images for later use when we place them in serial fashion 
    [scrollView1 addSubview:imageView]; 
    [imageView release]; 

} [self layoutScrollImages]; //现在把串行布局的照片滚动视图

}

回答

0

这真的取决于你想要做的事情中。 UIScrollView用于连续滚动 - 例如,您希望用户能够同时查看漫画图像1的右半部分和漫画图像2的左半部分。

如果您真正想要的是更加分散地查看图像(“下一页”/“上一页”范例),您可能希望在它们之间有单独的视图和动画 - 不会有任何图像UIScrollView。

如果你解释你真正想要的行为,我可以给你更多的细节。

+0

它基本上就像你在App Store中看到那些漫画书应用程序。你滑动,然后进入下一页。所以我很难以这种方式设置它。有任何想法吗? – Dane 2009-08-06 05:36:28