Scroll View with Navigation Bar within another Scroll View

I have an app with three view controllers that the user can swipe between. The app loads up on the middle view controller. I am trying to create a sort of help screen, made up of a scroll view containing 3 images that the user can swipe between, as well as a navigation bar at the top to allow the user to exit the help screen. This help screen is to be displayed on top of the main scroll view, leaving 20px margin all the way around.

This is my code so far, creating the help scroll view:

if ([[ UIScreen mainScreen ] bounds ].size.height == 568 ) {
    NSArray *images = [[NSArray alloc] initWithObjects:[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
}

This was me trying to get it to work on the 4" screens. When I ran the simulator, the one image in the scroll view was shown on the far left of the main scroll view, and had no navigation bar.

This is how my xib is set out:

And here is the result:

The main scroll view still scrolls. I do not want this. Basically what I want is for this help scroll view to show up with my images, and allow the user to scroll through them before closing it, and continouing to the main app.

How can I do this?

Answers


  1. Your ImageView is added on the top of layer stack when [self.scrollView addSubview:imageView] is executed, so it just hides the NavigationBar
  2. Your helpScrollView seems to be wrong positioned. You may add constraints to properly position it.
  3. If you want main ScrollView not to respond touches you should set mainScrollView.scrollEnabled=NO before displaying help ScrollView and when it hides set nack to YES;

Need Your Help

WPF click and drag-and-drop events clashing?

wpf events drag-and-drop click

I have a WPF ListBox, where the items are styled to be Buttons. I've used gong-wpf-dragdrop to very easily implement drag-and-drop, so I can reorder the listitems. However, I would now like to be a...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.