{"id":13628817,"url":"https://github.com/honcheng/PaperFold-for-iOS","last_synced_at":"2025-04-17T04:32:29.249Z","repository":{"id":4036987,"uuid":"5138050","full_name":"honcheng/PaperFold-for-iOS","owner":"honcheng","description":"Paper folding animation for iOS","archived":false,"fork":false,"pushed_at":"2016-02-17T15:22:51.000Z","size":18070,"stargazers_count":2699,"open_issues_count":44,"forks_count":397,"subscribers_count":194,"default_branch":"master","last_synced_at":"2025-04-14T03:11:32.294Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/honcheng.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}},"created_at":"2012-07-22T00:56:08.000Z","updated_at":"2025-03-22T09:26:09.000Z","dependencies_parsed_at":"2022-08-18T23:10:25.354Z","dependency_job_id":null,"html_url":"https://github.com/honcheng/PaperFold-for-iOS","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honcheng%2FPaperFold-for-iOS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honcheng%2FPaperFold-for-iOS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honcheng%2FPaperFold-for-iOS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honcheng%2FPaperFold-for-iOS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/honcheng","download_url":"https://codeload.github.com/honcheng/PaperFold-for-iOS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249315998,"owners_count":21249871,"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":[],"created_at":"2024-08-01T22:00:57.848Z","updated_at":"2025-04-17T04:32:29.222Z","avatar_url":"https://github.com/honcheng.png","language":"Objective-C","readme":"\nPaperFold for iOS\n=================\n\nPaperFold is a simple iOS control that allows hiding of views on the left and right side of the screen by dragging the middle view. \nThe left view supports only 1 fold. The right view supports variable number of folds. \n\n\u003cimg width=150 src=\"https://github.com/honcheng/PaperFold-for-iOS/raw/master/Screenshots/1.png\"/\u003e \u003cimg width=150 src=\"https://github.com/honcheng/PaperFold-for-iOS/raw/master/Screenshots/2.png\"/\u003e \u003cimg width=150 src=\"https://github.com/honcheng/PaperFold-for-iOS/raw/master/Screenshots/3.png\"/\u003e \u003cimg width=150 src=\"https://github.com/honcheng/PaperFold-for-iOS/raw/master/Screenshots/4.png\"/\u003e\n\n*Vertical fold is still in active testing, in an experimental branch (top-multifold) at the moment.*  \n\n\u003cimg width=150 src=\"https://github.com/honcheng/PaperFold-for-iOS/raw/master/Screenshots/5-topfold.png\"/\u003e \u003cimg width=150 src=\"https://github.com/honcheng/PaperFold-for-iOS/raw/master/Screenshots/6-topfold.png\"/\u003e \u003cimg width=150 src=\"https://github.com/honcheng/PaperFold-for-iOS/raw/master/Screenshots/7-topfold.png\"/\u003e \u003cimg width=150 src=\"https://github.com/honcheng/PaperFold-for-iOS/raw/master/Screenshots/8-bottomfold.png\"/\u003e \u003cimg width=150 src=\"https://github.com/honcheng/PaperFold-for-iOS/raw/master/Screenshots/9-bottomfold.png\"/\u003e  \n\u003cimg width=300 src=\"https://github.com/honcheng/PaperFold-for-iOS/raw/master/Screenshots/verticalfold.gif\"/\u003e\n\n\nHow it works\n------------\n\nDuring folding, a screen capture of the left/right view is taken, and split up depending on the number of folds required. The virtual light source is on the right side of the screen, so surfaces that faces the left are darker. For the right multi-fold view, the fold closes to the 'force' are opened up faster than the folds that is further away.\n\nA sample project is included.\n\nExample\n-------\n\nRefer to this [link](http://www.honcheng.com/2012/02/Playing-with-folding-navigations) for a video showing the prototype of an app that I was working on. In the end, the proposed project was never completed because I could not obtained reliable data for the app, but I intend to use it for another app. \n\n\u003cimg width=300 src=\"https://github.com/honcheng/PaperFold-for-iOS/raw/master/Screenshots/leftfold.gif\"/\u003e \u003cimg width=300 src=\"https://github.com/honcheng/PaperFold-for-iOS/raw/master/Screenshots/rightfold.gif\"/\u003e\n\nThe animation here looks a bit laggy, but that's because of the low frame rates in GIF.\n\nUsage\n-----\n\n1) Add PaperFoldView as a subview into your view controller. \n\n    _paperFoldView = [[PaperFoldView alloc] initWithFrame:CGRectMake(0,0,100,[self.view bounds].size.height)];\n    [self.view addSubview:_paperFoldView];\n\n2) To set left view, use setLeftFoldContentView:foldCount:pullFactor:. Example below uses a UITableView, but it can any UIView.\n\n    _leftTableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0,100,[self.view bounds].size.height)];\n    [_paperFoldView setLeftFoldContentView:_leftTableView foldCount:3 pullFactor:0.9];\n\n3) To set the right view, use setRightFoldContentView:foldCount:pullFactor:. Example below uses a MKMapView, but it can any UIView. The fold count is the number of folds in the right view. The pull factor controls the ratio of folding/unfolding of the different folds away from the center.\n\n    _mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0,0,240,[self.view bounds].size.height)];\n    [_paperFoldView setRightFoldContentView:_mapView foldCount:3 pullFactor:0.9];\n\n4) To set the center view\n\n\t_centerTableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0,[self.view bounds].size.height,[self.view bounds].size.height)];\n    [_paperFoldView setCenterContentView:_centerTableView];\n\n4) Sometimes you may want to disable drag-to-unfold if you have a table view in the center view and wish to preserve the swipe gesture functions e.g. to delete cells. \n\n    // this disables dragging to unfold the left view\n    [self.paperFoldView setEnableLeftFoldDragging:NO];\n\n    // this disables dragging to unfold the right view\n    [self.paperFoldView setEnableRightFoldDragging:NO];\n\n\n5) To unfold left view without dragging\n\n    [self.paperFoldView setPaperFoldState:PaperFoldStateLeftUnfolded];\n\n6) To unfold right view without dragging\n\n    [self.paperFoldView setPaperFoldState:PaperFoldStateRightUnfolded];\n\n7) To restore view to center without dragging\n\n    [self.paperFoldView setPaperFoldState:PaperFoldStateDefault];\n\n8) To receive callbacks when fold state changes, and if the fold was activated manually by finger gesture, or automatically by calling setPaperFoldState:\n\n    // register callback delegate\n    [self.paperFoldView setDelegate:self];\n\n    // callback comes from the following delegate method \n    - (void)paperFoldView:(id)paperFoldView didFoldAutomatically:(BOOL)automatic toState:(PaperFoldState)paperFoldState\n\n\nRequirements\n---\n\nThis project uses ARC. If you are not using ARC in your project, add '-fobjc-arc' as a compiler flag for all the files in this project.\nXCode 4.4 is required for auto-synthesis.\n\nApps that uses PaperFold\n------------------------\n\n[Showy](https://itunes.apple.com/sg/app/id547022322)\n, [LargeType](https://itunes.apple.com/sg/app/largetype-full-screen-text/id568459406)\n, [NextRide](https://itunes.apple.com/us/app/nextride-singapore-public/id565103559) \n, [SG NextBus](https://itunes.apple.com/sg/app/sg-nextbus/id361404839)\n, [Hangzhou Metro](https://itunes.apple.com/cn/app/hang-zhou-de-tie/id518531257?mt=8)\n\n[Contact me](http://twitter.com/honcheng) if you want your app listed here. Thanks \n\n\nOther Projects that uses PaperFold\n----------------------------------\t\n\n[PaperFoldMenuController](https://github.com/honcheng/PaperFoldMenuController) by me.\n\n[PaperFold CocoaPod Demo for RubyMotion](https://github.com/yestoall/PaperFold-pod-DEMO) by [yestoall](yestoall).\n\n[Titanium Mobile Mobule for PaperFold](https://github.com/atsusy/TiPaperFold) by [atsusy](https://github.com/atsusy/).\n\nKnown Problem\n-------------\n\nScreen capture of MKMapView is iOS6 is not taken properly. I approached a few Apple engineers at WWDC, and was told that it is most likely a bug that need to fix. I have already filed a bug report (filed as rdar://11813051, closed by Apple because it is a duplicate of rdar://11650331). Hopefully it will be fixed soon. \n\n**Update:** This bug is fixed in iOS6b4. No problem taking screenshot of MKMapView. \n\nCredits\n------\n\nSpecial thanks to [@dilliontan](http://twitter.com/dilliontan), my colleague in [buUuk](http://buuuk.com) for explaining CAAffineTransform. He's a master at that :p. I'm still a noob. \nYou can check out his [iOS-Flip-Transform project here](https://github.com/Dillion/iOS-Flip-Transform).\n\nContact\n------\n\n[twitter.com/honcheng](http://twitter.com/honcheng)\n[honcheng.com](http://honcheng.com)\n\n![](http://www.cocoacontrols.com/analytics/honcheng/paperfold-for-ios.png)\n","funding_links":[],"categories":["Objective-C  Stars 1000以内排名整理","Objective-C","etc","Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoncheng%2FPaperFold-for-iOS","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoncheng%2FPaperFold-for-iOS","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoncheng%2FPaperFold-for-iOS/lists"}