{"id":18269904,"url":"https://github.com/shabib87/SHViewPager","last_synced_at":"2025-04-04T23:31:39.484Z","repository":{"id":17082876,"uuid":"19847955","full_name":"shabib87/SHViewPager","owner":"shabib87","description":"A simple view pager for iOS. Compatible with iOS 8.0 or later.","archived":true,"fork":false,"pushed_at":"2016-10-24T07:25:01.000Z","size":1100,"stargazers_count":124,"open_issues_count":5,"forks_count":25,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-17T20:13:43.230Z","etag":null,"topics":["objective-c","objective-c-library","pager","swift","swift3","viewpager"],"latest_commit_sha":null,"homepage":"https://www.codewithshabib.com","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shabib87.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-16T07:19:58.000Z","updated_at":"2024-11-04T21:16:39.000Z","dependencies_parsed_at":"2022-08-26T13:00:13.265Z","dependency_job_id":null,"html_url":"https://github.com/shabib87/SHViewPager","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shabib87%2FSHViewPager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shabib87%2FSHViewPager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shabib87%2FSHViewPager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shabib87%2FSHViewPager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shabib87","download_url":"https://codeload.github.com/shabib87/SHViewPager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266476,"owners_count":20910831,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["objective-c","objective-c-library","pager","swift","swift3","viewpager"],"created_at":"2024-11-05T11:37:48.891Z","updated_at":"2025-04-04T23:31:37.950Z","avatar_url":"https://github.com/shabib87.png","language":"Objective-C","readme":"![SHViewPager](Images/codewithshabib.png)\n\n# SHViewPager\n\n[![Version](https://img.shields.io/cocoapods/v/SHViewPager.svg?style=flat)](http://cocoapods.org/pods/SHViewPager)\n[![License](https://img.shields.io/cocoapods/l/SHViewPager.svg?style=flat)](http://cocoapods.org/pods/SHViewPager)\n[![Platform](https://img.shields.io/cocoapods/p/SHViewPager.svg?style=flat)](http://cocoapods.org/pods/SHViewPager)\n\n- A simple view pager for iOS, which acts similar to android's viewPager. Compatible with iOS 8.0 or later. Supports iPhones and iPads in all interface orientation.\n\n## Table of contents\n\n * [Preview](#preview)\n * [Advantages](#advantages)\n * [Demo project](#demo-project)\n * [Requirements](#requirements)\n * [Installation](#installation)\n    * [Cocoapods](#cocoapods)\n    * [Source files](#source-files)\n * [How to use](#how-to-use)\n * [Known Issues](#known-issues)\n * [Author](#author)\n * [Contact](#contact)\n * [License](#license)\n\n## Preview\n\niPhone interface:\u003cbr/\u003e\u003cbr/\u003e\n[![iPhone screen](Images/SHViewPager_iphoneScreens.gif)](Images/SHViewPager_iphoneScreens.gif)\n\u003cbr/\u003e\u003cbr/\u003eiPad interface:\u003cbr/\u003e\u003cbr/\u003e\n[![iPad screen](Images/SHViewPager_ipadScreens.gif)](Images/SHViewPager_ipadScreens.gif)\n\n## Advantages\n\n * [x] Supports both Swift (v2.2 and v3.0) and Objective-C\n * [x] Supports all orientations\n * [x] Supports iPad\n * [x] Supports Autolayout\n\n## Demo project\n\nFully workable examples; both in Objective-C and Swift; are included. If you want to try it yourself, just download/checkout this repository, and run `pod install` from the Example directory first. Then open the `SHViewPager.xcworkspace` with Xcode.\n\n## Requirements\n\n* Xcode 6+\n* iOS 8+\n* ARC\n\n## Installation\n\n###Cocoapods\n\n*Recommended way*\n\nSHViewPager is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\nuse_frameworks!\ntarget '\u003cYourTarget\u003e' do\n\tpod 'SHViewPager', '~\u003e 2.0'\nend\n```\n\n###Source files\n\n1. Download the [latest code version](http://github.com/shabib87/SHViewPager/archive/master.zip) or add the repository as a git submodule to your git-tracked project.\n2. Drag and drop the **Classes** and the **Resources** directory from the archive in your project navigator. Make sure to select *Copy items* when asked if you extracted the code archive outside of your project.\n\nUse SHViewPager wherever you need it with `#import \u003cSHViewPager/SHViewPagerModule.h\u003e` in Objective-C and `import SHViewPager` in Swift.\n\n##How to use\n\nThe `SHViewPager` needs it's `datasource` and `delegate` protocols to be implemented. Simply initialize it from code or better: \n\n**Method 1**\n\n1. Drag and drop an `UIView` from the Storyboard to your `UIViewController`.\n2. Change the class to `SHViewPager`, and \n3. Finally connect the `datasource`, `delegate` and your property `IBOutlet`.\n\n**Method 2**\n\n1. Drag and drop an `UIViewController` to the Storyboard.\n2. Change the class to `SHViewPagerController`\n\nFour `datasource` methods are required and others are optional.\n\n**Objective-C: The required datasource methods are**\n\n```objc\n- (NSInteger)numberOfPagesInViewPager:(SHViewPager *)viewPager;\n```\n\n```objc\n- (UIViewController *)containerControllerForViewPager:(SHViewPager *)viewPager;\n```\n```objc\n- (UIViewController *)viewPager:(SHViewPager *)viewPager controllerForPageAtIndex:(NSInteger)index;\n````\n\nand,\n\n\n```objc\n- (NSString *)viewPager:(SHViewPager *)viewPager titleForPageMenuAtIndex:(NSInteger)index;\n````\n\nor,\n\n\n```objc\n- (UIImage *)viewPager:(SHViewPager *)viewPager imageForPageMenuAtIndex:(NSInteger)index;\n````\n\n**Swift: The required datasource methods are**\n\n```swift\nfunc numberOfPages(in viewPager: SHViewPager) -\u003e Int\n```\n```swift\nfunc containerController(for viewPager: SHViewPager) -\u003e UIViewController\n```\n```swift\nfunc viewPager(_ viewPager: SHViewPager, controllerForPageAt index: Int) -\u003e UIViewController\n````\n\nand,\n\n\n```swift\nfunc viewPager(_ viewPager: SHViewPager, titleForPageMenuAt index: Int) -\u003e String\n````\n\nor,\n\n\n```swift\nfunc viewPager(_ viewPager: SHViewPager, imageForPageMenuAt index: Int) -\u003e UIImage\n````\n\nTo display the contents, you need to call the instance method `reloadData` in your desired method block; typically in `viewDidLoad`; and `pagerWillLayoutSubviews` in `viewWillLayoutSubviews`.\n\n-Example:\n\n*Objective-C*\n\n```objc\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    // your code\n    [viewPager reloadData];\n}\n\n-(void)viewWillLayoutSubviews {\n    [super viewWillLayoutSubviews];\n    [_pager pagerWillLayoutSubviews];\n}\n\n```\n\n*Swift*\n\n```swift\noverride func viewDidLoad() {\n    super.viewDidLoad()\n    // your code\n    pager.reloadData()\n}\n\noverride func viewWillLayoutSubviews() {\n    super.viewWillLayoutSubviews()\n    pager.pagerWillLayoutSubviews()\n}\n\n```\n\n## Known Issues\n\nPlease refer to the [open issue list](https://github.com/shabib87/SHViewPager/issues?q=is%3Aopen+is%3Aissue).\n\n## Author\n\n**Created by** Ahmad Shabibul Hossain, [@shabib_hossain](https://twitter.com/shabib_hossain) on 5/15/14.\n\n## Contact\n\nShare feedbacks and ideas to improve this project, I would love to hear them out. You can also follow me on [@shabib_hossain](https://twitter.com/shabib_hossain).\n\n## License\n\nSHViewPager is available under the MIT license. See the LICENSE file for more info.\n","funding_links":[],"categories":["viewpager"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshabib87%2FSHViewPager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshabib87%2FSHViewPager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshabib87%2FSHViewPager/lists"}