2009-08-01 98 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