美文网首页
MJExtension完成相册选择选择的功能

MJExtension完成相册选择选择的功能

作者: iOS乐乐 | 来源:发表于2020-04-03 14:53 被阅读0次

    最新开发的一个新功能, 里面包含了很多的步骤,其中步骤数量是后台返回来的(第一步,第二部......), 每个步骤中每个区间的标题以及每个区间的数量后台都返回来了, 其中每个区间后台设置了MaxNum该区间最多上传图片的个数
    大致思路如下,首先想要解决该功能的话,需要使用到MJExtension这个模型的框架
    ①创建model模型进行接收
    ②动态的判断当前区间的个数, 到达个数后不再显示多余上传图片的按钮,不满足的话继续显示额外图片的按钮
    ③每次上传后都需要对模型进行动态的更改model中使用到了这个属性进行动态的控制,这个为可变的数组
    @property (nonatomic, strong) NSMutableArray<CaseListModel*> *caseList;
    ④如果是添加新的图片的话, 在caseList数组中增加CaseListModel对象
    ⑤如果是更改的话,取出来需要更改的对象然后对该对象适当的进行更改就可以完美的解决问题了
    ⑥方法过程不重要, 重要的是思路

    创建model模型
    #import <Foundation/Foundation.h>
    @class CaseListModel;
    NS_ASSUME_NONNULL_BEGIN
    
    @interface CopywritingListModel : NSObject
    
    @property(nonatomic,strong)NSString*copywritingDes;
    @property(nonatomic,strong)NSString*filesTypeStep;
    @property(nonatomic,strong)NSString*copywritingType;
    @property(nonatomic,strong)NSString*caseId;
    @property(nonatomic,strong)NSString*num;
    @property(nonatomic,strong)NSString*idStr;
    @property(nonatomic,strong)NSString*defaultUrl;
    @property (nonatomic, strong) NSMutableArray<CaseListModel*> *caseList;
    //@property (nonatomic, strong) NSMutableArray *caseList;
    
    @end
    @interface CaseListModel : NSObject
    @property(nonatomic,strong)NSString*uid;
    @property(nonatomic,strong)NSString*filesName;
    @property(nonatomic,strong)NSString*copywritingType;
    @property(nonatomic,strong)NSString*address;
    @property(nonatomic,strong)NSString*companyName;
    @property(nonatomic,strong)NSString*caseId;
    @property(nonatomic,strong)NSString*step;
    @property(nonatomic,strong)NSString*state;
    @property(nonatomic,strong)NSString*type;
    @property(nonatomic,strong)NSString*userName;
    @property(nonatomic,strong)NSString*userId;
    @property(nonatomic,strong)NSString*filesUrl;
    @end
    
    NS_ASSUME_NONNULL_END
    
    #import "CopywritingListModel.h"
    
    @implementation CopywritingListModel
    
    + (NSDictionary *)mj_replacedKeyFromPropertyName {
    
        return @{@"idStr":@"id"};
    }
    +(NSDictionary*)mj_objectClassInArray{
        return @{@"caseList":@"CaseListModel"};
    }
    @end
    
    Simulator Screen Shot - iPhone 8 - 2020-04-03 at 14.43.52.png
    Simulator Screen Shot - iPhone 8 - 2020-04-03 at 14.44.50.png

    相关文章

      网友评论

          本文标题:MJExtension完成相册选择选择的功能

          本文链接:https://www.haomeiwen.com/subject/zfbhphtx.html