{"id":19571315,"url":"https://github.com/orucanil/carouselview","last_synced_at":"2025-04-27T03:32:13.744Z","repository":{"id":197658161,"uuid":"52421399","full_name":"orucanil/CarouselView","owner":"orucanil","description":"Carousel View","archived":false,"fork":false,"pushed_at":"2016-08-18T17:59:30.000Z","size":37,"stargazers_count":22,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T20:51:15.211Z","etag":null,"topics":["carousel","carousel-scrolls","carouselview","ios","objective-c","uiview"],"latest_commit_sha":null,"homepage":"https://www.linkedin.com/in/annul","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/orucanil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-02-24T06:57:23.000Z","updated_at":"2023-03-06T17:36:23.000Z","dependencies_parsed_at":"2023-10-02T00:10:28.447Z","dependency_job_id":null,"html_url":"https://github.com/orucanil/CarouselView","commit_stats":null,"previous_names":["orucanil/carouselview"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orucanil%2FCarouselView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orucanil%2FCarouselView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orucanil%2FCarouselView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orucanil%2FCarouselView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orucanil","download_url":"https://codeload.github.com/orucanil/CarouselView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251085147,"owners_count":21533821,"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":["carousel","carousel-scrolls","carouselview","ios","objective-c","uiview"],"created_at":"2024-11-11T06:18:25.155Z","updated_at":"2025-04-27T03:32:13.366Z","avatar_url":"https://github.com/orucanil.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CarouselView\n\nThe component was used in the platinum application : https://itunes.apple.com/tr/app/turkcell-platinum-size-ozel/id671494224?mt=8\n\n## Display Visual Example \n\n----\n![Visual1](http://g.recordit.co/elt6VbPnPF.gif)\n\n\nInstallation\n--------------\n\nTo use the PLCarouselView class in an app, just drag the PLCarouselView class files (demo files and assets are not needed) into your project and add the QuartzCore framework.\n\n\nProperties\n--------------\n\nThe PLCarouselView has the following properties (note: for iOS, UIView when using properties):\n\n    @property (nonatomic, weak) IBOutlet id\u003cPLCarouselViewDataSource\u003e dataSource;\n\nAn object that supports the PLCarouselViewDataSource protocol and can provide views to populate the scroll.\n\n    @property (nonatomic, weak) IBOutlet id\u003cPLCarouselViewDelegate\u003e delegate;\n\nAn object that supports the PLCarouselViewDelegate protocol and can respond to scroll events and layout requests.\n\n    @property (nonatomic, assign) BOOL vertical;\n\nThis property toggles whether the carousel is displayed horizontally or vertically on screen. All the built-in carousel types work in both orientations. Switching to vertical changes both the layout of the carousel and also the direction of swipe detection on screen. Note that custom carousel transforms are not affected by this property, however the swipe gesture direction will still be affected. Defaulth value is NO.\n\n    @property (nonatomic, assign) BOOL scrollEnabled;\n\nEnables and disables user scrolling of the carousel. The carousel can still be scrolled programmatically if this property is set to NO.\n\n    @property (nonatomic, assign, readonly) NSUInteger currentPageIndex;\n\nThe index of the currently centered item in the carousel. Setting this property is equivalent to calling `scrollToItemAtIndex:animated:` with the animated argument set to NO. \n\n\nMethods\n--------------\n\nThe PLCarouselView class has the following methods (note: for iOS, UIView in method arguments):\n\n    + (instancetype)init;\n\nCustom initialize method.\n\n    + (instancetype)initWithFrame:(CGRect)frame;\n\nCustom initialize method.\n\n    - (UIView*)visibleItemWithType:(PLCarouselViewVisibleItem)type;\n\nReturns the visible item view with the specified PLCarouselViewVisibleItem (PLCarouselViewVisibleItemCurrent, PLCarouselViewVisibleItemNext or PLCarouselViewVisibleItemPrevious).\n\n    - (void)scrollToItemAtIndex:(NSInteger)index animated:(BOOL)animated;\n\nThis will center the carousel on the specified item, either immediately or with a smooth animation. For wrapped carousels, the carousel will automatically determine the shortest (direct or wraparound) distance to scroll. If you need to control the scroll direction, or want to scroll by more than one revolution, use the scrollByNumberOfItems method instead.\n\n    - (void)reloadData;\n\nThis reloads all carousel views from the dataSource and refreshes the carousel display.\n\n\nProtocols\n---------------\n\nThe PLCarouselView follows the Apple convention for data-driven views by providing two protocol interfaces, PLCarouselViewDataSource and PLCarouselViewDelegate. The PLCarouselViewDataSource protocol has the following required methods (note: for iOS, UIView in method arguments):\n\n    -(NSUInteger)numberOfItemsInCarousel:(PLCarouselView *)carouselView;\n\nReturn the number of items (views) in the carousel.\n\n    -(UIView*)carouselView:(PLCarouselView *)carouselView viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view;\n\nReturn a view to be displayed at the specified index in the carousel. The `reusingView` argument works like a UIPickerView, where views that have previously been displayed in the carousel are passed back to the method to be recycled. If this argument is not nil, you can set its properties and return it instead of creating a new view instance, which will slightly improve performance. Unlike UITableView, there is no reuseIdentifier for distinguishing between different carousel view types, so if your carousel contains multiple different view types then you should just ignore this parameter and return a new view each time the method is called. You should ensure that each time the `carouselView:viewForItemAtIndex:reusingView:` method is called, it either returns the reusingView or a brand new view instance rather than maintaining your own pool of recyclable views, as returning multiple copies of the same view for different carousel item indexes may cause display issues with the carousel.\n\nThe PLCarouselViewDelegate protocol has the following optional methods:\n\n    -(void)carouselCurrentItemIndexDidChange:(PLCarouselView *)carouselView currentIndex:(NSUInteger)currentIndex previousIndex:(NSUInteger)previousIndex;\n\nThis method is called whenever the carousel scrolls far enough for the currentPageIndex property to change. It is called regardless of whether the item index was updated programatically or through user interaction.\n\n    -(void)carouselView:(PLCarouselView*)carouselView didSelectItemAtIndex:(NSUInteger)index;\n\nThis method will fire if the user taps any carousel item view, including the currently selected view. This method will not fire if the user taps a control within the currently selected view (i.e. any view that is a subclass of UIControl).\n\n-(void)carouselView:(PLCarouselView*)carouselView didScrollDiffrenceRate:(CGFloat)diffRate;\n\nThis method is called whenever the carousel scrolls far enough for the contentOffset property to change. It is called regardless of whether the item contentOffset was updated programatically or through user interaction.\n\n-(void)carouselView:(PLCarouselView*)carouselView didMoveToView:(UIView*)view;\n\nThis method is called whenever the carousel scrolls far enough for the currentPageIndex property to change and the item move into carousel view. It is called regardless of whether the item view was updated programatically or through user interaction.\n\n-(void)carouselView:(PLCarouselView*)carouselView changedScrollDirection:(PLCarouselViewDirection)direction;\n\nThis method is called whenever the carousel scrolls far enough for the contentOffset property to change. It is called regardless of whether the carousel contentOffset was updated programatically or through user interaction. (PLCarouselViewDirectionStatic, PLCarouselViewDirectionUp, PLCarouselViewDirectionDown, PLCarouselViewDirectionLeft or PLCarouselViewDirectionRight)\n\n\nHow to use ?\n----------\n\n```Objective-C\n#import \"PLCarouselView.h\"\n\n@interface ViewController () \u003cPLCarouselViewDataSource,PLCarouselViewDelegate\u003e\n\n...\n\n- (void)loadView\n{\n[super loadView];\n\nPLCarouselView *_carousel = [PLCarouselView init];\n\n[_carousel setFrame:[UIScreen mainScreen].bounds];\n\n_carousel.delegate = self;\n\n_carousel.dataSource = self;\n\n_carousel.vertical = YES;\n\n[self.view addSubview:_carousel];\n\n[_carousel reloadData];\n\n}\n\n...\n\n#pragma mark - PLCarouselView delegates \u0026 datasources\n\n-(UIView *)carouselView:(PLCarouselView *)carouselView viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view\n{\n    if(view)\n    {\n        return view;\n    }\n    else\n    {\n        return [UIView new];\n    }\n}\n\n-(NSUInteger)numberOfItemsInCarousel:(PLCarouselView *)carouselView\n{\n    return 10;\n}\n\n-(void)carouselView:(PLCarouselView *)carouselView didMoveToView:(UIView *)view\n{\n\n}\n\n-(void)carouselCurrentItemIndexDidChange:(PLCarouselView *)carouselView currentIndex:(NSUInteger)currentIndex previousIndex:(NSUInteger)previousIndex\n{\n\n}\n\n-(void)carouselView:(PLCarouselView *)carouselView didSelectItemAtIndex:(NSUInteger)index\n{\n\n}\n\n-(void)carouselView:(PLCarouselView *)carouselView changedScrollDirection:(PLCarouselViewDirection)direction\n{\nswitch (direction) {\ncase PLCarouselViewDirectionDown:\n{\n[self.navigationController setNavigationBarHidden:YES animated:YES];\n}\nbreak;\ncase PLCarouselViewDirectionUp:\n{\n[self.navigationController setNavigationBarHidden:NO animated:YES];\n}\nbreak;\ncase PLCarouselViewDirectionLeft:\n{\n[self.navigationController setNavigationBarHidden:NO animated:YES];\n}\nbreak;\ncase PLCarouselViewDirectionRight:\n{\n[self.navigationController setNavigationBarHidden:NO animated:YES];\n}\nbreak;\ncase PLCarouselViewDirectionStatic:\n{\n\n}\nbreak;\ndefault:\nbreak;\n}\n}\n\n-(void)carouselView:(PLCarouselView *)carouselView didScrollDiffrenceRate:(CGFloat)diffRate\n{\n\n}\n\n\n```\n\nBuild and run the project files. Enjoy more examples!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forucanil%2Fcarouselview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forucanil%2Fcarouselview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forucanil%2Fcarouselview/lists"}