【问题标题】:left to right scrolling in landscape and addSubView在横向和 addSubView 中从左到右滚动
【发布时间】:2009-08-01 23:27:16
【问题描述】:

我的漫画书应用程序已启动并正在运行,但缺少一些内容。

1) 我想让图像从左向右滚动,但我让应用在打开时自动设置为横向模式。我在哪里调整应用程序的这一部分? (顺便说一句......它在纵向模式下从左到右)

2) 我有两张图片显示...我在哪里通过 addSubView 在我的代码中添加其他 22 张图片?

// 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];

} [自我布局滚动图像]; // 现在将照片以串行布局放置在滚动视图中

}

【问题讨论】:

    标签: iphone xcode horizontal-scrolling


    【解决方案1】:

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

    如果您真正想要的是更离散地查看图像(“下一页”/“上一页”范式),您可能只想有单独的视图并在它们之间设置动画 - 不会有 UIScrollView完全没有。

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

    【讨论】:

    • 它基本上就像你在应用商店看到的那些漫画书应用。您轻扫,然后进入下一页。所以我很难以这种方式进行设置。有什么想法吗?
    • 看看黑马的《终结者:死亡谷#1》,这正是我想要达到的目标。
    【解决方案2】:
    猜你喜欢
    • 2014-07-09
    • 1970-01-01
    • 1970-01-01
    • 2012-12-07
    • 2012-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-30
    相关资源
    最近更新 更多