Slider control - no storyboard?


#1

I’m confused by the slider control in the Essentials bundle.  The example shows manually creating/adding controls.  Can I design my views in the storyboard still and yet use the slider control?


#2

Hi Gargoyle,

The sliding overlay works with UIViews rather than UIViewControllers, so you wouldn’t be able to use the UIViewControllers which you would design in the storyboard. However, you would be able to create a XIB file for each individual view, and then use Interface Builder to design each one. You can do that by adding a new file to your project, then selecting the View template from the User Interface section of the available templates.

Once you have designed your view in Interface Builder, you can then add that view onto either the underlay or overlay of the sliding overlay control. So, if I created a view XIB file called OverlayView.xib, I would then be able to add it to a sliding overlay like so:

NSArray *nibContents = [[NSBundle mainBundle] loadNibNamed:@"OverlayView"
                                                         owner:self
                                                       options:nil];
    // We're assuming here that your nib's top level contains only the view you want, so it's the only item in the array.
    UIView *myView = [nibContents objectAtIndex:0];
    myView.frame = slidingView.overlay.bounds;
    [slidingView.overlay addSubview:myView];

I hope this helps, let me know how things go.

Regards,

Dan