Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
NSDrowned opened this issue Apr 19, 2013 · 1 comment
Open
Labels

Comments

@NSDrowned
Copy link

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).

@kris2point0
Copy link
Owner

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants