From 7f12dd5c1880e3e6b766e94f797698a3f9080565 Mon Sep 17 00:00:00 2001
From: nash_su <nash.yong@gmail.com>
Date: Sun, 22 Feb 2015 20:32:13 +0800
Subject: [PATCH] fix error when embed in tab bar controller.

move code in viewWillAppear to viewDidLoad to avoid error when embed in
tab bar controller.
---
 RKSwipeBetweenViewControllers.m | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/RKSwipeBetweenViewControllers.m b/RKSwipeBetweenViewControllers.m
index 64dcd10..e4d15e3 100644
--- a/RKSwipeBetweenViewControllers.m
+++ b/RKSwipeBetweenViewControllers.m
@@ -53,6 +53,9 @@ - (void)viewDidLoad
     self.navigationBar.translucent = NO;
     viewControllerArray = [[NSMutableArray alloc]init];
     currentPageIndex = 0;
+    
+    [self setupPageViewController];
+    [self setupSegmentButtons];
 }
 
 //This stuff here is customizeable: buttons, views, etc
@@ -152,11 +155,13 @@ -(void)setupSelector
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%//
 //                                                        //
 
--(void)viewWillAppear:(BOOL)animated
-{
-    [self setupPageViewController];
-    [self setupSegmentButtons];
-}
+
+//move these code to viewDidLoad to avoid error when embed in tab bar controller.
+//-(void)viewWillAppear:(BOOL)animated
+//{
+//    [self setupPageViewController];
+//    [self setupSegmentButtons];
+//}
 
 //%%% generic setup stuff for a pageview controller.  Sets up the scrolling style and delegate for the controller
 -(void)setupPageViewController