类说明

优质
小牛编辑
119浏览
2023-12-01

类说明

模型类

DTGif

说明: 动图模型类

/**
图片id
*/
@property (nonatomic, strong) NSString *imageId;

/**
图片名称
*/
@property (nonatomic, strong) NSString *text;

/**
图片缩略图地址
*/
@property (nonatomic, strong) NSString *thumbImage;

/**
图片缩略图地址  动图
*/
@property (nonatomic, strong) NSString *gifThumbImage;

/**
*  图片地址
*  可能是GIF、PNG、JPG格式
*/
@property (nonatomic, strong) NSString *mainImage;

/**
*  图片尺寸(pix)
*/
@property (nonatomic, assign) CGSize size;

/**
*  是否是动态图片
*/
@property (nonatomic, assign) BOOL isAnimated;

DTUser

说明: APP 用户模型类

/**
 用户id
 */
@property (nullable, nonatomic, retain) NSString *userId;


/**
 用户名
 */
@property (nullable, nonatomic, retain) NSString *name;

/**
 电话
 */
@property (nullable, nonatomic, retain) NSString *phone;

/**
 邮件
 */
@property (nullable, nonatomic, retain) NSString *email;

/**
 地址
 */
@property (nullable, nonatomic, retain) NSString *address;

/**
 用户性别  1:男,2:女
 */
@property (nonatomic) NSInteger gender;

/**
 其他信息
 */
@property (nullable, nonatomic, retain) NSDictionary *otherInfo;

管理类

Dongtu

说明: SDK 主要功能管理类

属性

/**
 *  SDK 功能的代理
 */
@property (nonatomic, weak, nullable) id<DongtuDelegate> delegate;

Dongtu 单例

+ (nonnull instancetype)sharedInstance;

初始化

/**
@param appid 申请的 appid
@param secret 申请的 secret
*/
- (void)initWithAppId:(NSString *)appid secret:(NSString *)secret;

获取 SDK 的版本

/**
@return SDK 的版本
*/
+ (NSString *)version;

设置app本地用户信息

/**
@param user 用户信息构造的DTUser对象
*/
+(void)setUser:(DTUser *)user;

配置联想表情功能

/**
 *  @param attachedView   联想表情UI展示在attachedView上方
 *  @param input          联想表情功能关联的输入框
 */
- (void)shouldShowSearchPopupAboveView:(nonnull UIView *)attachedView
                             withInput:(nonnull UIResponder <UITextInput> *)input;

将联想表情UI从页面上移除

- (void)dismissSearchPopup;

触发gif搜索

- (void)triggerSearchGifWindow;

开发者需实现的代理方法

//点击了联想UI和GIF UI中的表情图片代理
- (void)didSelectGif:(DTGif *)gif;

UI相关类

DTTheme

说明: 可对SDK 的 UI进行一定程度的自定义

/**
DTTheme 单例
*/
+ (instancetype)sharedTheme;

/**
图片左下角文字背景色
*/
@property (nonatomic, strong, nullable) UIColor *emojiTitleBgColor;

/**
图片左下角第一个label的颜色
*/
@property (nonatomic, strong, nullable) UIColor *emojiTitle1Color;

/**
图片左下角第二个label的颜色
*/
@property (nonatomic, strong, nullable) UIColor *emojiTitle2Color;

/**
图片详情页navigationbar title fonts
*/
@property (nonatomic, strong, nullable) UIFont *navigationTitleFont;

/**
图片详情页navigationbar 背景色
*/
@property (nonatomic, strong, nullable) UIColor  *navigationBarColor;

/**
navigationbar tint color
*/
@property (nonatomic, strong, nullable) UIColor  *navigationBarTintColor;


/**
图片详情页加载失败提示文字字体
*/
@property (nonatomic, strong, nullable) UIFont   *loadFailedLabelFont;

/**
图片详情页加载失败提示文字颜色
*/
@property (nonatomic, strong, nullable) UIColor  *loadFailedLabelColor;

/**
图片详情页加载失败 重新加载按钮字体
*/
@property (nonatomic, strong, nullable) UIFont   *reloadBtnFont;

/**
图片详情页加载失败 重新加载按钮文字颜色
*/
@property (nonatomic, strong, nullable) UIColor  *reloadBtnColor;

DTImageView

说明: 展示动图数据的控件

/**
设置DTImageView的image
*/
@property (nonatomic, strong, nullable) UIImage *image;

/**
设置DTImageView加载图片失败后显示的图片
*/
@property (nonatomic, strong, nullable) UIImage *errorImage;

/**
计算DTImageView尺寸

@param size 图片尺寸
@param mSize DTImageView控件最大尺寸
@return DTImageView尺寸
*/
+ (CGSize)sizeForImageSize:(CGSize)size imgMaxSize: (CGSize)mSize;

/**
设置图片数据函数

@param urlString 图片url
@param gifId 图片id
*/
- (void)setImageWithDTUrl:(NSString * _Nonnull)urlString gifId:(NSString * _Nonnull)gifId;

/**
设置图片数据函数

@param urlString 图片url
@param gifId 图片id
@param handler 函数回调
*/
- (void)setImageWithDTUrl:(NSString * _Nonnull)urlString gifId:(NSString * _Nonnull)gifId completHandler:(void (^_Nullable)(BOOL success))handler;

/**
DTImageView 重用
*/
- (void)prepareForReuse;