MTPhotoPicker 是一个具有自定义和旋转支持的 iMessage 风格的照片选择器,适用于您的应用程序
要运行示例项目,请首先从 Example 目录克隆仓库,然后运行 pod install
或者
创建照片选择器对象
MTPhotoPicker * _pickerView = [MTPhotoPicker pickerWithTitle:@"Choose Photo" alternateTitle:@"Attach photos (%ld)" otherTitles:@[@"Choose video",@"Capture"] cancelTitle:@"Cancel"];
实现委托方法
#pragma mark - MTPhotoPickerDelegate
-(BOOL)photoPickerShouldDismissWithAssets:(NSArray *)assets{
return YES;
}
-(void)photoPickerAssetsSelected:(NSArray *)assets{
//use ALAsset array
}
-(void)photoPickerDidDismiss{
_pickerView = nil;
}
-(void)photoPickerButtonItemClicked:(NSInteger)itemInedx{
//handle custom buttons click
}
显示选择器
[_pickerView loadAssets:^{
[self.pickerView showInView:self.view];
}];
MTPhotoPicker 通过 CocoaPods 提供。要安装它,只需在 Podfile 中添加以下行
pod "MTPhotoPicker"
Ulyanov Dmitry, [email protected]
MTPhotoPicker 在 MIT 许可协议下提供。有关更多信息,请参阅 LICENSE 文件。