云头像(iOS)
安装
SDK集成
cocoaPods 集成
Podfile
文件platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'App' do
pod 'AvatarCloudSDK'
end
pod install
pod repo update
手动集成
AvatarCloudSDK.framework
和资源文件AvatarCloudSDK.bundle
复制到业务工程使用
配置
clientId
和 clientSecret
请在官网申请#import <AvatarCloudSDK/AvatarCloudSDK.h>
//controller:跳转界面容器。 animated:跳转动画
[[AvatarCloudSDKManager sharedInstance] initWithParentController:self animated:YES];
//设置sdk内部头像圆角尺寸
[AvatarCloudSDKManager sharedInstance].cornerRadius = 24;
//默认NO,设置YES时,cornerRadius无效
[AvatarCloudSDKManager sharedInstance].isCircle = NO;
//获取生成的图片,返回对象类型UIImage
[[AvatarCloudSDKManager sharedInstance] getImage:^(UIImage * _Nonnull image) {
weakSelf.avatarView.image = image;
}];
//获取生成的图片,返回对象类型NSData
[[AvatarCloudSDKManager sharedInstance] getImageData:^(NSData * _Nonnull imageData) {
weakSelf.avatarView.image = [UIImage imageWithData:imageData];
}];
修改于 2022-08-08 02:17:03