Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pager Sliding TabStrip in ios

I would like to use Pager Sliding TabStrip in my project.Pager Sliding Tapstrip is there for android. Can we define like this? I have taken one scroll view, added subviews on it for tables and take one uivew, added buttons as subviews and added uilabel as subview for tabstrip . While using the scrollview means dragging the scrollview, the tabsrip has to be moved.I have been stuck to this concept and i am not getting any idea to solve this issue. How do i get this concept? Please give any idea to me anyone.

like image 750
Prasad G Avatar asked Jun 24 '14 06:06

Prasad G


4 Answers

Can't you use UIPageControl for this ?

From Apple example:

https://developer.apple.com/library/ios/samplecode/PageControl/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007795

And to have a custom UIPageControl, like this https://github.com/Spaceman-Labs/SMPageControl .

like image 176
smaryus Avatar answered Oct 21 '22 03:10

smaryus


You can try UIPageViewController to manage your tabs.

I'm not sure how many tabs do you have. If you have many tabs and you add all tables into the scrollView at the beginning time, the performance and memory usage would be really bad.

So you'd better reuse controller and views for your tabs. If you use UIScrollView and manage them by yourself, what you can do is calculate current page according to the contentOffset, and load the current page, previous page and next page. Because three pages is enough to cover what user will see. However the better solution is using UIPageViewController, it will deal with contentOffset and pagination, what your need to do is just provide previous controller and next controller according to current controller. Then update your tab view according to current controller.

EDIT:

BTW, if by "the tabstrip has to be moved" you mean when you drag the scrollView, your tabstrip moves as well, that's because you added your tabstrip to the scrollView. What you need to do is add it to the root view, and the scrollView and the tabstrip should be siblings rather than parent and child.

like image 23
Allen Hsu Avatar answered Oct 21 '22 01:10

Allen Hsu


I am developing application which required same features as asked by you. I am using SHViewPageController. You can find it from following link.

https://www.cocoacontrols.com/controls/shviewpagerexample

I hope it will help you. Thanks.

like image 1
girish_pro Avatar answered Oct 21 '22 01:10

girish_pro


This may help you.... you can change the tab at top or bottom. also it has got some nice customizations https://github.com/iltercengiz/ICViewPager

like image 1
Nikhil M Das Avatar answered Oct 21 '22 01:10

Nikhil M Das