# CTAssetsPickerController **Repository Path**: public-open/CTAssetsPickerController ## Basic Information - **Project Name**: CTAssetsPickerController - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-12-10 - **Last Updated**: 2024-04-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # CTAssetsPickerController ## Development Change (2019-12-10) 修改create_bundle.sh文件去除国际化,需要国际化的可以不用修改: ``` #!/bin/sh BUNDLE="CTAssetsPickerController/CTAssetsPickerController.bundle" rm -rf $BUNDLE mkdir $BUNDLE find "CTAssetsPickerController/Resources" -name "*.png" | xargs -I {} cp {} "$BUNDLE/" find "CTAssetsPickerController/Resources" -name "zh-Hans.lproj" | xargs -I {} cp -R {} "$BUNDLE/" echo "Created $BUNDLE" ``` 修改podfile文件: ``` platform :ios, '8.0' target 'CTAssetsPickerDemo' do use_frameworks! pod 'CTAssetsPickerController', :path => '.' end ``` 修改CTAssetsPickerController.podspec文件: ``` # spec.resource_bundles = { 'CTAssetsPickerController' => ['CTAssetsPickerController/Resources/*/*.png', 'CTAssetsPickerController/Resources/*.lproj'] } spec.resource_bundles = { 'CTAssetsPickerController' => ['CTAssetsPickerController/Resources/CTAssetsPicker.xcassets', 'CTAssetsPickerController/Resources/zh-Hans.lproj'] } ``` ## Introduction CTAssetsPickerController is a highly customisable iOS controller that allows picking multiple photos and videos from user's photo library. The usage and look-and-feel are just similar to UIImagePickerController. It uses **ARC** and requires **Photos** framework. ![Screenshot](Screenshot.png "Screenshot") ![Screenshot 2](Screenshot-2.png "Screenshot 2") ## Release Notes * [Release Notes](https://github.com/chiunam/CTAssetsPickerController/releases) ## Minimum Requirement iOS 9 SDK, Minimum Deployment Target iOS 8.0 ## Adding to your project 1. [CocoaPods](http://cocoapods.org) Podfile ```` platform :ios, '8.0' pod 'CTAssetsPickerController', '~> 3.3.0' ```` 2. [Manual Setup](https://github.com/chiunam/CTAssetsPickerController/wiki/Manual-Setup-(v3)) ## Usages 1. Import header ```` objective-c #import ```` 2. Create and present CTAssetsPickerController ```` objective-c // request authorization status [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status){ dispatch_async(dispatch_get_main_queue(), ^{ // init picker CTAssetsPickerController *picker = [[CTAssetsPickerController alloc] init]; // set delegate picker.delegate = self; // Optionally present picker as a form sheet on iPad if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) picker.modalPresentationStyle = UIModalPresentationFormSheet; // present picker [self presentViewController:picker animated:YES completion:nil]; }); }]; ```` 3. Implement didFinishPickingAssets delegate If the picker is presented by `presentViewController:animated:completion:` method, the delegate is responsible for dismissing the picker when the operation completes. ```` objective-c - (void)assetsPickerController:(CTAssetsPickerController *)picker didFinishPickingAssets:(NSArray *)assets { // assets contains PHAsset objects. } ```` ## Questions, Issues and Suggestions Please check with [wiki](https://github.com/chiunam/CTAssetsPickerController/wiki/) and [issues](https://github.com/chiunam/CTAssetsPickerController/issues) for common issues and questions. Please open a [new Issue] (https://github.com/chiunam/CTAssetsPickerController/issues/new) if you run into a problem specific to the picker. Bug reports and pull requests are always welcome. ## Bonus You may reuse the preview feature of the picker to view any assets. Just init a `CTAssetsPageViewController` with an array of assets and assign `pageIndex` property. Please refer to the [demo app](https://github.com/chiunam/CTAssetsPickerController/wiki/Running-demo-app) for the details. ```` objective-c NSArray *assets = @[asset1, asset2, asset3, ...]; CTAssetsPageViewController *vc = [[CTAssetsPageViewController alloc] initWithAssets:assets]; vc.pageIndex = assets.count - 1; // display the last asset [self.navigationController pushViewController:vc animated:YES]; ```` ## Documentation * [Online documentation](http://cocoadocs.org/docsets/CTAssetsPickerController/) ## License The MIT License (MIT) Copyright (c) 2019 Clement CN Tsang