Circular Infinite Scrolling Tabs iOS Custom Control

Few days back I was working on making a tab control for an iOS application with a requirement having an innate scrolling tab, This control is builtin found in android, So I searching out but I didn’t found any reliable custom control library or source code for iOS, So on my own I decided to develop. I developed this custom control using.

  • UIScrollView ( iOS builtin View).
  •  Paging is disabled.
  • Used a UIWebView to display my webpage.

Here is a sample screenshot

InfiniteScrolling Tabs

So what I did lets consider you have 8 tabs named 1, 2, 3, 4, 5, 6, 7, 8. So you have to load 10 items in the UIScrollView with vertical scrolling disabled in the following order  8, 1, 2, 3, 4, 5, 6, 7, 8, 1 , First item is replicated at last and last item is replicated at first, we did this because in appearance it start looking circular but in actual we are changing frames and repeating the same button object again and again so that it looks infinite scrolling.

So here is code by which you can disable vertical scrolling in UIScrollView

scrollView.contentSize = CGSizeMake(106*7,_scrollViewController.frame.size.height);

In the above code 106 is the button width and I have total 7 button so total width of content size of scrollview will be 106*7. In your case it should be like button width * total number of buttons.

Its upto you how you make button, what I did I just put a button instance in a loop and based on index I placed them in scrollview frame from origin point of UIScrollView, Here is code of loading these essential stuff


Now when user starts dragging in the UIScrollVIew, We need a scrollview delegate in which we can do this processing, Now I have optimised this for just three tabs, You can optimise with desired number of tabs, Here is code of scrollview delegate method

 infinitecircular scrollview

I am not going to place all the code here. You can download the project from the Git hub

You may also be interested in following articles

Login with Vimeo in iOS Development

Login With Google iOS tutorial Using Oauth

Login With SoundCloud iOS Tutorial Using Oauth

Login With Twitter

Login With Tumblr Using oAuth

Login With ForSquare iOS



One Response

Leave a Reply