CLFContainerViewController icon indicating copy to clipboard operation
CLFContainerViewController copied to clipboard

How do I create a simple tabbed container inside another view?

Open NSDrowned opened this issue 12 years ago • 1 comments

Your demo project is too complicated for me :( As you can see I'm kind of new at this, and I'm trying to create a tabbed view, something like this:

SAMPLE-view.

Can you control work with a subview (or child view, don't know the exact name) like that?

I've been trying to use xcode's pageview controller for the past couple of days without any success. There's too little info on the net on how to use multiple views with a pageview controller.

I also saw your provided a tabbed subclass but I simply don't understand how to implement it. Can you provide a simple demo on how to use it?

Sorry for my bad english (not my first language).

NSDrowned avatar Apr 19 '13 06:04 NSDrowned

There's two ways you could go about it using the CLFTabbedContainerViewController. You can either override the childRestingFrame property (described in CLFContainerViewController.h) to be the frame of your "Load Views Here" section. Or you could use an embed segue in your storyboard, and embed a CLFTabbedContainerViewController in that.

In the example project, the MainViewController class is a subclass of CLFTabbedContainerViewController that demonstrates how you can use it. In that example, a segmented control is used to switch between view controllers, but you can just as easily have your buttons switch between them. You would just need to call switchToViewController: or switchToViewControllerAtIndex: when they are tapped.

The default behavior of a CLFTabbedContainerViewController is to transition between child view controllers with no animation. If you want animation, you will need to set the animateTransitions property to YES. Then, if you want the animations to be different than the default (which is a 0.5 second fade with the option UIViewAnimationOptionBeginFromCurrentState), you will need to either override the preAnimationBlock, animationBlocks, animationDurations, and animationOptions properties (or you can alternatively override the switchToViewController:animated:withCompletionBlock: method).

kris2point0 avatar Apr 19 '13 12:04 kris2point0