Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override func viewDidLoad() {
- super.viewDidLoad();
- // 1) Create the three views used in the swipe container view
- var BVc :BViewController = BViewController(nibName: "BViewController", bundle: nil);
- var AVc :AViewController = AViewController(nibName: "AViewController", bundle: nil);
- var CVc :CViewController = CViewController(nibName: "CViewController", bundle: nil);
- // 2) Add in each view to the container view hierarchy
- // Add them in opposite order since the view hieracrhy is a stack
- self.addChildViewController(BVc);
- self.scrollView!.addSubview(BVc.view);
- BVc.didMoveToParentViewController(self);
- self.addChildViewController(AVc);
- self.scrollView!.addSubview(AVc.view);
- AVc.didMoveToParentViewController(self);
- self.addChildViewController(CVc);
- self.scrollView!.addSubview(CVc.view);
- CVc.didMoveToParentViewController(self);
- // 3) Set up the frames of the view controllers to align
- // with eachother inside the container view
- var BFrame :CGRect = BVc.view.frame;
- BFrame.origin.x = 2*BFrame.width;
- CVc.view.frame = BFrame;
- var adminFrame :CGRect = AVc.view.frame;
- adminFrame.origin.x = adminFrame.width;
- BVc.view.frame = adminFrame;
- // 4) Finally set the size of the scroll view that contains the frames
- var scrollWidth: CGFloat = 3 * self.view.frame.width
- var scrollHeight: CGFloat = self.view.frame.size.height
- self.scrollView!.contentSize = CGSizeMake(scrollWidth, scrollHeight);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement