我正在制作一个应用程序,其中有一个滚动视图之间的三个视图控制器。我正在制作一个帮助菜单,应该出现在滚动视图的顶部,作为另一个滚动视图,包含3个图像,解释应用程序。这是滚动视图顶部的滚动视图。到目前为止,我的代码如下:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
StopwatchViewController *svc = [[StopwatchViewController alloc]init];
[self addChildViewController:svc];
[self.scrollView addSubview:svc.view];
[svc didMoveToParentViewController:self];
BarsViewController *bvc = [[BarsViewController alloc] init];
CGRect frame = bvc.view.frame;
frame.origin.x = 320;
bvc.view.frame = frame;
[self addChildViewController:bvc];
[self.scrollView addSubview:bvc.view];
[bvc didMoveToParentViewController:self];
TimerViewController *tvc = [[TimerViewController alloc]init];
frame = tvc.view.frame;
frame.origin.x = 320 * 2;
frame.origin.y = 44;
tvc.view.frame = frame;
[self.scrollView.panGestureRecognizer requireGestureRecognizerToFail:tvc.pan];
[self addChildViewController:tvc];
[self.scrollView addSubview:tvc.view];
[tvc didMoveToParentViewController:self];
self.scrollView.contentSize = CGSizeMake(320*3, self.view.frame.size.height);
self.scrollView.pagingEnabled = YES;
self.scrollView.contentOffset = CGPointMake(320,0);
[self.scrollView setShowsHorizontalScrollIndicator:NO];
// THIS IS WHERE IT GOES WRONG
if ([[ UIScreen mainScreen ] bounds ].size.height == 568 ) {
    NSArray *images = [[NSArray alloc] initWithObjects:[UIImage imageNamed:@"Guide Page One.png"], [UIImage imageNamed:@"Guide Page One.png"], [UIImage imageNamed:@"Guide Page One.png"], nil];
    self.helpScrollView.contentSize = CGSizeMake(280 * 3, 528);
    self.helpScrollView.pagingEnabled = YES;
CGFloat xPos = 0.0;
for (UIImage *image in images) {
    UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
    imageView.frame = CGRectMake(xPos, 0.0, 280, 528);
    [self.scrollView addSubview:imageView];
    xPos += 280;
    // assuming ARC, otherwise release imageView
}
self.helpScrollView.contentOffset = CGPointMake(340,20);
}
[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(showHelp)
                                             name:@"showWelcomeMessage"
                                           object:nil];
}我的代码的第一部分(直到注释)工作正常。我可以在三个视图控制器之间滑动。接下来,我想让用户按下一个按钮,并让这个新的滚动视图出现在顶部(从边缘留出20px的边距)。它的顶部应该有一个导航栏,如下所示:

..to允许用户退出帮助菜单,并返回到应用程序。我在这里真的迷路了,因为我只是Objective-C的初学者。
我只想在主滚动视图上有一个滚动视图,它将呈现3个图像来解释应用程序。
任何帮助都非常感谢,因为我真的不知道下一步该做什么,而且我似乎在这个网站上找不到任何与我的问题类似的东西。如果需要,请询问更多信息!
非常感谢!
发布于 2013-12-10 05:03:07
如果用户按下下一步按钮,你想滚动页面的内容吗?
https://stackoverflow.com/questions/20480067
复制相似问题