Search code examples
iosipadcalendaruislider

slider control similar to ipad default calendar app


I would like to know how to implement the slider similar to the one in the Ipad default calendar application. I have attached the image below ipad calendar application

If you see at the bottom, it acts like a slider which allows us to select any month either by just pressing it or sliding to it.

It would be great if anyone could tell me the name of that control. I tried using UISlider but I see that it allows only 3 options:

  • setThumbImage
  • setMinimumTrackImage
  • setMaximumTrackImage

If that control is indeed a slider control, could anyone tell me how I would be able to insert multiple images/ text

Thanks


Solution

  • This can be achieved by using UIScrollView. Add UIButtons programmatically having background images and text as well on them as per your requirement.

    You can refer tutorial1 tutorial2 in which on screen only 1 page(Image) is displayed. You need to do some calculation for applying same logic to fit your requirement. i.e. Your scrollview will be smaller(in height) and bigger(in width) as displayed in image, you will be adding UIButtons in spite of images and most important at a time displaying more than 1 item but it won't be difficult. The Main part is only programmatically scrolling.