You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The library provides many ways to show the PagerTabStrip menu.
27
+
## Pager Types
28
+
29
+
The library provides 4 different ways to show the view controllers.
30
+
31
+
### Button Bar
32
+
33
+
This is likely to be the most common pager type. It's used by many well known apps such as instagram, youtube, skype and many others.
34
+
35
+
<imgsrc="Example/barButton.gif"width="250"/>
36
+
37
+
### Bar
38
+
39
+
This mode doesn't show a title neither a image. It only shows a bar that indicates the current view controller.
40
+
41
+
<imgsrc="Example/bar.gif"width="250"/>
42
+
43
+
### Twitter
44
+
45
+
Long time ago twitter app made use of this type of pager in the app main screen.
46
+
47
+
<imgsrc="Example/twitter.gif"width="250"/>
48
+
49
+
### Segmented
50
+
51
+
This mode uses a `UIsegmentedControl` to indicates which is the view controller being displayed.
52
+
53
+
<imgsrc="Example/segmented.gif"width="250"/>
28
54
29
55
## Usage
30
56
31
57
32
-
Basically we just need to provide the list of child view controllers to show and these view controllers should provide the information (title or image) to show in the associated indicator.
58
+
Basically we just need to provide the list of child view controllers to show and these view controllers should provide the information (title or image) that will be shown in the associated indicator.
33
59
34
60
Let's see the steps to do this:
35
61
36
62
##### Choose which type of pager we want to create
37
63
38
-
Fist step is choose how we want to show our pager step controller, it must extend from any of the following controllers: `TwitterPagerTabStripViewController`, `ButtonBarPagerTabStripViewController`, `SegmentedPagerTabStripViewController`, `BarPagerTabStripViewController`.
64
+
Fist we should choose the type of pager we want to create, depending on our choice we will have to create a view controller that extend from one of the following controllers: `TwitterPagerTabStripViewController`, `ButtonBarPagerTabStripViewController`, `SegmentedPagerTabStripViewController`, `BarPagerTabStripViewController`.
39
65
40
66
> All these build-in pager controllers extend from the base class `PagerTabStripViewController`.
41
67
> You can also make your custom pager controller by extending directly from `PagerTabStripViewController` in case no pager menu type fits your needs.
@@ -50,36 +76,34 @@ class MyPagerTabStripName: ButtonBarPagerTabStripViewController {
50
76
51
77
##### Connect outlets and add layout constraints
52
78
53
-
We strongly recommend to use IB to set up your page controller views.
79
+
We strongly recommend to use IB to set up our page controller views.
54
80
55
81
Drag into the storyboard a `UIViewController` and set up its class with your pager controller (`MyPagerTabStripName`).
56
82
Drag a `UIScrollView` into your view controller view and connect `PagerTabStripViewController``contentView` outlet with the scroll view.
57
83
58
84
Depending on which type of paging view controller you are working with you may have to connect more outlets.
59
85
60
-
For `BarPagerTabStripViewController` you should connect `barView` outlet.
61
-
For `ButtonBarPagerTabStripViewController` you should connect `buttonBarView` outlet.
62
-
For `SegmentedPagerTabStripViewController` you should connect `segmentedControl` outlet.
63
-
`TwitterPagerTabStripViewController` doesn't require to connect any additional outlet.
86
+
For `BarPagerTabStripViewController` we should connect `barView` outlet. `ButtonBarPagerTabStripViewController` requires us to connect `buttonBarView` outlet. `SegmentedPagerTabStripViewController` has a `segmentedControl` outlet, if the outlet is not connected the library try to set up the navigationItem titleView using a `UIsegmentedControl`. `TwitterPagerTabStripViewController` doesn't require to connect any additional outlet.
64
87
65
-
> The example project contains a example for each pager controller type and you can look into it to see how views were added and how outlets were connected.
88
+
> The example project contains a example for each pager controller type and we can look into it to see how views were added and how outlets were connected.
66
89
67
-
##### Provide view controllers that will appear embedded into the PagerTabStrip view controller
90
+
##### Provide the view controllers that will appear embedded into the PagerTabStrip view controller
68
91
69
-
You can provide the view controllers by overriding `func childViewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController]` method.
92
+
You can provide the view controllers by overriding `func viewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController]` method.
> The method above is the only method contained in `PagerTabStripViewControllerDataSource`. We don't need to explicitly conform to it since base pager class already does it.
100
+
> The method above is the only method declared in `PagerTabStripViewControllerDataSource` protocol. We don't need to explicitly conform to it since base pager class already does it.
78
101
79
102
80
103
##### Provide information to show in each indicator
81
104
82
-
Every UIViewController that will appear in the PagerTabStrip controller should conforms to `PagerTabStripChildItem`. The only method this protocol requires to implement is `func childHeaderForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> ChildItemInfo`
105
+
Every UIViewController that will appear within the PagerTabStrip controller needs to provide either a title or an image.
106
+
In order to do so they should conform to `PagerTabStripChildItem` by implementing `func childHeaderForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> ChildItemInfo`
83
107
which provides the information required to show the PagerTabStrip menu (indicator) associated with the view controller.
0 commit comments