ImageFacePan易于使用。它有两个类方法,可以从另一个UIImage生成UIImage。使用它的简单方法是
+(UIImage *)renderImageFromImage:(UIImage *)image toFitSize:(CGSize)destinationSize;
当使用这个方法时,您只需要传递图像和图像的目标大小。渲染将裁剪图像,将所有面部放入帧中而不进行缩放。此方法使用目标大小宽高比。
如果无缩放裁剪不足以使用,您应该使用
+(UIImage *)renderImageFromImage:(UIImage *)image withOptions:(MTZImageFacePanOptions *)options;
此方法需要您传递一个可以设置最小宽度、最小高度和最大缩放因子的选项对象。这允许带有缩放的滚动。
此库用于所有在填充imageView时某些面部图像未被帧捕获的情况。
原始图像
横向宽高比
更多示例在/Pod/Assets文件夹中
ImagePicker可通过CocoaPods获取。要安装它,只需将以下行添加到您的Podfile中
pod "MTZImageFacePan"
Michael Tzach,[email protected]
Copyright 2013-2016 Jive Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://apache.ac.cn/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.