爆款云主机2核4G限时秒杀,88元/年起!
查看详情

活动

天翼云最新优惠活动,涵盖免费试用,产品折扣等,助您降本增效!
热门活动
  • 618智算钜惠季 爆款云主机2核4G限时秒杀,88元/年起!
  • 免费体验DeepSeek,上天翼云息壤 NEW 新老用户均可免费体验2500万Tokens,限时两周
  • 云上钜惠 HOT 爆款云主机全场特惠,更有万元锦鲤券等你来领!
  • 算力套餐 HOT 让算力触手可及
  • 天翼云脑AOne NEW 连接、保护、办公,All-in-One!
  • 中小企业应用上云专场 产品组合下单即享折上9折起,助力企业快速上云
  • 息壤高校钜惠活动 NEW 天翼云息壤杯高校AI大赛,数款产品享受线上订购超值特惠
  • 天翼云电脑专场 HOT 移动办公新选择,爆款4核8G畅享1年3.5折起,快来抢购!
  • 天翼云奖励推广计划 加入成为云推官,推荐新用户注册下单得现金奖励
免费活动
  • 免费试用中心 HOT 多款云产品免费试用,快来开启云上之旅
  • 天翼云用户体验官 NEW 您的洞察,重塑科技边界

智算服务

打造统一的产品能力,实现算网调度、训练推理、技术架构、资源管理一体化智算服务
智算云(DeepSeek专区)
科研助手
  • 算力商城
  • 应用商城
  • 开发机
  • 并行计算
算力互联调度平台
  • 应用市场
  • 算力市场
  • 算力调度推荐
一站式智算服务平台
  • 模型广场
  • 体验中心
  • 服务接入
智算一体机
  • 智算一体机
大模型
  • DeepSeek-R1-昇腾版(671B)
  • DeepSeek-R1-英伟达版(671B)
  • DeepSeek-V3-昇腾版(671B)
  • DeepSeek-R1-Distill-Llama-70B
  • DeepSeek-R1-Distill-Qwen-32B
  • Qwen2-72B-Instruct
  • StableDiffusion-V2.1
  • TeleChat-12B

应用商城

天翼云精选行业优秀合作伙伴及千余款商品,提供一站式云上应用服务
进入甄选商城进入云市场创新解决方案
办公协同
  • WPS云文档
  • 安全邮箱
  • EMM手机管家
  • 智能商业平台
财务管理
  • 工资条
  • 税务风控云
企业应用
  • 翼信息化运维服务
  • 翼视频云归档解决方案
工业能源
  • 智慧工厂_生产流程管理解决方案
  • 智慧工地
建站工具
  • SSL证书
  • 新域名服务
网络工具
  • 翼云加速
灾备迁移
  • 云管家2.0
  • 翼备份
资源管理
  • 全栈混合云敏捷版(软件)
  • 全栈混合云敏捷版(一体机)
行业应用
  • 翼电子教室
  • 翼智慧显示一体化解决方案

合作伙伴

天翼云携手合作伙伴,共创云上生态,合作共赢
天翼云生态合作中心
  • 天翼云生态合作中心
天翼云渠道合作伙伴
  • 天翼云代理渠道合作伙伴
天翼云服务合作伙伴
  • 天翼云集成商交付能力认证
天翼云应用合作伙伴
  • 天翼云云市场合作伙伴
  • 天翼云甄选商城合作伙伴
天翼云技术合作伙伴
  • 天翼云OpenAPI中心
  • 天翼云EasyCoding平台
天翼云培训认证
  • 天翼云学堂
  • 天翼云市场商学院
天翼云合作计划
  • 云汇计划
天翼云东升计划
  • 适配中心
  • 东升计划
  • 适配互认证

开发者

开发者相关功能入口汇聚
技术社区
  • 专栏文章
  • 互动问答
  • 技术视频
资源与工具
  • OpenAPI中心
开放能力
  • EasyCoding敏捷开发平台
培训与认证
  • 天翼云学堂
  • 天翼云认证
魔乐社区
  • 魔乐社区

支持与服务

为您提供全方位支持与服务,全流程技术保障,助您轻松上云,安全无忧
文档与工具
  • 文档中心
  • 新手上云
  • 自助服务
  • OpenAPI中心
定价
  • 价格计算器
  • 定价策略
基础服务
  • 售前咨询
  • 在线支持
  • 在线支持
  • 工单服务
  • 建议与反馈
  • 用户体验官
  • 服务保障
  • 客户公告
  • 会员中心
增值服务
  • 红心服务
  • 首保服务
  • 客户支持计划
  • 专家技术服务
  • 备案管家

了解天翼云

天翼云秉承央企使命,致力于成为数字经济主力军,投身科技强国伟大事业,为用户提供安全、普惠云服务
品牌介绍
  • 关于天翼云
  • 智算云
  • 天翼云4.0
  • 新闻资讯
  • 天翼云APP
基础设施
  • 全球基础设施
  • 信任中心
最佳实践
  • 精选案例
  • 超级探访
  • 云杂志
  • 分析师和白皮书
  • 天翼云·创新直播间
市场活动
  • 2025智能云生态大会
  • 2024智算云生态大会
  • 2023云生态大会
  • 2022云生态大会
  • 天翼云中国行
天翼云
  • 活动
  • 智算服务
  • 产品
  • 解决方案
  • 应用商城
  • 合作伙伴
  • 开发者
  • 支持与服务
  • 了解天翼云
      • 文档
      • 控制中心
      • 备案
      • 管理中心

      iOS中第三方有序字典框架——M13OrderedDictionary

      首页 知识中心 云端实践 文章详情页

      iOS中第三方有序字典框架——M13OrderedDictionary

      2024-06-18 07:22:41 阅读次数:39

      iOS

      iOS中第三方有序字典框架——M13OrderedDictionary

      一、引言

              M13OrderedDictionary是拥有字典和数组功能的第三方集合序列,开发者可以通过索引和键值来实现对其中元素的访问。其实现了NSArray和NSDictionary中的所有方法,并且支持KVC与KVO。

              M13OederedDictionary中提供的方法包括:

      1.创建与初始化。

      2.访问键和值

      3.查询与搜索。

      4.发送消息。

      5.比较与排序。

      6.枚举与遍历。

      7.描述与存储。

      8.KVO键值监听。

      9.KVC键值编码。

      10.索引与下标。

              另外,M13OrderedDictionary针对Xcode7也做了许多优化,例如引入了泛型的代码支持的风格。

      二、M13OrderedDictionary中方法与属性解析

      //类方法创建实例对象
      //默认的初始化方法
      + (instancetype)orderedDictionary;
      //使用M13OrderedDictionary来创建实例对象
      + (instancetype)orderedDictionaryWithOrderedDictionary:(M13OrderedDictionary M13Generics(KeyType, ObjectType) *)orderedDictionary;
      //通过文件来创建实例对象
      + (instancetype)orderedDictionaryWithContentsOfFile:(NSString *)path;
      //通过URL来创建实例对象
      + (instancetype)orderedDictionaryWithContentsOfURL:(NSURL *)URL;
      //创建单键值实例对象
      + (instancetype)orderedDictionaryWithObject:(M13GenericType(ObjectType, id))anObject
      pairedWithKey:(M13GenericType(KeyType, id<NSCopying>))aKey;
      //通过NSDictionary创建实例对象
      + (instancetype)orderedDictionaryWithDictionary:(NSDictionary M13Generics(KeyType, ObjectType) *)entries;

      //初始化方法创建实例对象
      //默认的初始化方法
      - (instancetype)init;
      //使用M13OrderedDictionary来进行初始化
      - (instancetype)initWithOrderedDictionary:(M13OrderedDictionary M13Generics(KeyType, ObjectType) *)orderedDictionary;
      //使用M13OrderedDictionary来进行初始化 可选是否对其中元素进行复制操作
      - (instancetype)initWithOrderedDictionary:(M13OrderedDictionary M13Generics(KeyType, ObjectType) *)orderedDictionary copyEntries:(BOOL)flag;
      //通过文件来进行初始化
      - (instancetype)initWithContentsOfFile:(NSString *)path;
      //通过url来进行初始化
      - (instancetype)initWithContentsOfURL:(NSURL *)URL;
      //通过NSDictionary对象来进行初始化
      - (instancetype)initWithContentsOfDictionary:(NSDictionary M13Generics(KeyType, ObjectType) *)entries;
      //通过键数组与值数组来进行初始化
      - (instancetype)initWithObjects:(NSArray M13Generics(ObjectType) *)orderedObjects
      pairedWithKeys:(NSArray M13Generics(KeyType) *)orderedKeys NS_DESIGNATED_INITIALIZER;

      //方法
      //判断字典中是否包含某个元素
      - (BOOL)containsObject:(M13GenericType(ObjectType, id))object;
      //判断字典中是否包含某个键值对
      - (BOOL)containsObject:(M13GenericType(ObjectType, id))object
      pairedWithKey:(M13GenericType(KeyType, id<NSCopying>))key;
      //判断字典中是否包含某个键值对 传入的字典参数需要为单键值字典
      - (BOOL)containsEntry:(NSDictionary M13Generics(KeyType, ObjectType) *)entry;
      //获取字典中元素个数
      @property (nonatomic, readonly) NSUInteger count;
      //获取字典中最后一个元素的值
      @property (nonatomic, readonly, M13_NULLABLE) M13GenericType(ObjectType, id) lastObject;
      //获取字典中最后一个元素的键
      @property (nonatomic, readonly, M13_NULLABLE) M13GenericType(KeyType, id<NSCopying>) lastKey;
      //获取字典中最后一个元素键值对
      @property (nonatomic, readonly, M13_NULLABLE) NSDictionary M13Generics(KeyType, ObjectType) *lastEntry;
      //通过某个下标获取字典中的元素的值
      - (M13GenericType(ObjectType, id))objectAtIndex:(NSUInteger)index;
      //通过某个下标获取字典中的元素的键
      - (M13GenericType(KeyType, id<NSCopying>))keyAtIndex:(NSUInteger)index;
      //通过某个下标获取字段中的元素 返回的为单键值对NSDictionary对象
      - (NSDictionary M13Generics(KeyType, ObjectType) *)entryAtIndex:(NSUInteger)index;
      //通过一组下标获取一组元素的值
      - (NSArray M13Generics(ObjectType) *)objectsAtIndices:(NSIndexSet *)indeces;
      //通过一组下标获取一组元素的键
      - (NSArray M13Generics(KeyType) *)keysAtIndices:(NSIndexSet *)indices;
      //通过一组下标获取一组元素 这个方法获取的是有序集合
      - (M13OrderedDictionary M13Generics(KeyType, ObjectType) *)entriesAtIndices:(NSIndexSet *)indices;
      //通过一组下标获取一组元素 这个方法获取的是无序集合
      - (NSDictionary M13Generics(KeyType, ObjectType) *)unorderedEntriesAtIndices:(NSIndexSet *)indices;
      //示例中包含的无序字典集合
      @property (nonatomic, readonly) NSDictionary M13Generics(KeyType, ObjectType) *unorderedDictionary;
      //所有键组成的数组
      @property (nonatomic, readonly) NSArray M13Generics(KeyType) *allKeys;
      //所有值组成的数组
      @property (nonatomic, readonly) NSArray M13Generics(ObjectType) *allObjects;
      //获取某个值对应的所有键组成的数组
      - (NSArray M13Generics(KeyType) *)allKeysForObject:(M13GenericType(ObjectType, id))anObject;
      //获取某个键对应的值
      - (M13_NULLABLE M13GenericType(ObjectType, id))objectForKey:(M13GenericType(KeyType, id<NSCopying>))key;
      //获取某些键对应的值 如果没有找到 则可以设置默认返回的值 即参数anObject
      - (NSArray M13Generics(ObjectType) *)objectForKeys:(NSArray M13Generics(KeyType) *)keys
      notFoundMarker:(M13GenericType(ObjectType, id))anObject;
      //所有值的枚举
      @property (nonatomic, readonly) NSEnumerator M13Generics(ObjectType) *objectEnumerator;
      //所有键的枚举
      @property (nonatomic, readonly) NSEnumerator M13Generics(KeyType) *keyEnumerator;
      //所有元素的枚举
      @property (nonatomic, readonly) NSEnumerator M13Generics(NSDictionary<KeyType, ObjectType> *) *entryEnumerator;
      //所有值的反向枚举
      @property (nonatomic, readonly) NSEnumerator M13Generics(ObjectType) *reverseObjectEnumerator;
      //所有键的反向枚举
      @property (nonatomic, readonly) NSEnumerator M13Generics(KeyType) *reverseKeyEnumerator;
      //所有元素的反向枚举
      @property (nonatomic, readonly) NSEnumerator M13Generics(NSDictionary<KeyType, ObjectType> *) *reverseEntryEnumerator;
      //获取某个值的下标 找不到会返回NSNotFound
      - (NSUInteger)indexOfObject:(M13GenericType(ObjectType, id))object;
      //获取某个键的下标 找不到会返回NSNotFound
      - (NSUInteger)indexOfKey:(M13GenericType(KeyType, id<NSCopying>))key;
      //获取某个元素的下标 找不到会返回NSNotFound
      - (NSUInteger)indexOfEntryWithObject:(M13GenericType(ObjectType, id))object
      pairedWithKey:(M13GenericType(KeyType, id<NSCopying>))key;
      //通过NSDictionary来获取某个元素的下标 找不到会返回NSNotFound
      - (NSUInteger)indexOfEntry:(NSDictionary M13Generics(KeyType, ObjectType) *)entry;
      //通过元素的值在某个范围内查询下标
      - (NSUInteger)indexOfObject:(M13GenericType(ObjectType, id))object inRange:(NSRange)range;
      //通过元素的键在某个范围内查询下标
      - (NSUInteger)indexOfKey:(M13GenericType(KeyType, id<NSCopying>))key inRange:(NSRange)range;
      //在某个范围内查询某个元素的下标
      - (NSUInteger)indexOfEntryWithObject:(M13GenericType(ObjectType, id))object
      pairedWithKey:(M13GenericType(KeyType, id<NSCopying>))key
      inRange:(NSRange)range;
      - (NSUInteger)indexOfEntry:(NSDictionary M13Generics(KeyType, ObjectType) *)entry inRange:(NSRange)range;
      //查找与某个元素的值相同的元素下标
      - (NSUInteger)indexOfObjectIdenticalTo:(M13GenericType(ObjectType, id))object;
      //查找获取与某个元素的值相同的元素的键
      - (M13_NULLABLE M13GenericType(KeyType, id<NSCopying>))keyOfObjectIdenticalTo:(M13GenericType(ObjectType, id))object;
      //查找与某个元素的值相同的元素下标 在某个范围内进行查找
      - (NSUInteger)indexOfObjectIdenticalTo:(M13GenericType(ObjectType, id))object inRange:(NSRange)range;
      //查找获取与某个元素的值相同的元素的键 在某个范围内进行查找
      - (M13_NULLABLE M13GenericType(KeyType, id<NSCopying>))keyOfObjectIdenticalTo:(M13GenericType(ObjectType, id))object inRange:(NSRange)range;
      //符合查找block中检测条件的元素的下标
      /*
      开发者可以在block中获取到遍历出的 object与index,返回值决定是否停止查找
      */
      - (NSUInteger)indexOfObjectPassingTest:(BOOL (^)(M13GenericType(ObjectType, id) obj,
      NSUInteger idx,
      BOOL *stop))predicate;
      //同上 获取到的是键
      - (M13_NULLABLE M13GenericType(KeyType, id<NSCopying>))keyOfObjectPassingTest:(BOOL (^)(M13GenericType(ObjectType, id) obj, NSUInteger idx,BOOL *stop))predicate;
      //同上 只是这个方法可以设置枚举类型
      /*
      typedef NS_OPTIONS(NSUInteger, NSEnumerationOptions) {
      NSEnumerationConcurrent = (1UL << 0), //正向枚举
      NSEnumerationReverse = (1UL << 1), //逆向枚举
      };
      */
      - (NSUInteger)indexOfObjectWithOptions:(NSEnumerationOptions)opts passingTest:(BOOL (^)(M13GenericType(ObjectType, id) obj, NSUInteger idx, BOOL *stop))predicate;
      //同上 获取到的是元素
      - (M13_NULLABLE M13GenericType(KeyType, id<NSCopying>))keyOfObjectWithOptions:(NSEnumerationOptions)opts passingTest:(BOOL (^)(M13GenericType(ObjectType, id) obj, NSUInteger idx,BOOL *stop))predicate;
      //在一定下标集合中进行查找
      - (NSUInteger)indexOfObjectAtIndices:(NSIndexSet *)indexSet
      options:(NSEnumerationOptions)opts
      passingTest:(BOOL (^)(M13GenericType(ObjectType, id) obj, NSUInteger idx, BOOL *stop))predicate;
      //同上
      - (M13_NULLABLE M13GenericType(KeyType, id<NSCopying>))keyOfObjectAtIndices:(NSIndexSet *)indexSet options:(NSEnumerationOptions)opts passingTest:(BOOL (^)(M13GenericType(ObjectType, id) obj,NSUInteger idx,BOOL *stop))predicate;
      //在范围内进行比较查询
      - (NSUInteger)indexOfObject:(M13GenericType(ObjectType, id))object
      inSortedRange:(NSRange)r options:(NSBinarySearchingOptions)opts
      usingComparator:(NSComparator)cmp;
      //同上
      - (M13_NULLABLE M13GenericType(KeyType, id<NSCopying>))keyOfObject:(M13GenericType(ObjectType, id))object
      inSortedRange:(NSRange)r
      options:(NSBinarySearchingOptions)opts
      usingComparator:(NSComparator)cmp;
      //进行一组元素下标的查询
      - (NSIndexSet *)indicesOfObjectsPassingTest:(BOOL (^)(M13GenericType(ObjectType, id) obj,
      NSUInteger idx,
      BOOL *stop))predicate;
      - (NSIndexSet *)indicesOfObjectsWithOptions:(NSEnumerationOptions)opts
      passingTest:(BOOL (^)(M13GenericType(ObjectType, id) obj,
      NSUInteger idx,
      BOOL *stop))predicate;
      //进行一组元素键的查询
      - (NSArray M13Generics(KeyType) *)keysOfObjectsPassingTest:(BOOL (^)(M13GenericType(ObjectType, id) obj,
      NSUInteger idx,
      BOOL *stop))predicate;
      - (NSArray M13Generics(KeyType) *)keysOfObjectsWithOptions:(NSEnumerationOptions)opts
      passingTest:(BOOL (^)(M13GenericType(ObjectType, id) obj,
      NSUInteger idx,
      BOOL *stop))predicate;
      //向字典中的每一个元素发送消息
      - (void)makeObjectsPerformSelector:(SEL)aSelector;
      //向字典中的每一个元素发送消息 带参数
      - (void)makeObjectsPerformSelector:(SEL)aSelector withObject:(id)anObject;
      //对字典中的元素进行枚举遍历
      - (void)enumerateObjectsUsingBlock:(void (^)(M13GenericType(ObjectType, id) obj, NSUInteger idx, BOOL *stop))block;
      - (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts
      usingBlock:(void (^)(M13GenericType(ObjectType, id) obj, NSUInteger idx, BOOL *stop))block;
      //在一定范围内进行枚举
      - (void)enumerateObjectsAtIndices:(NSIndexSet *)indexSet
      options:(NSEnumerationOptions)opts
      usingBlock:(void (^)(M13GenericType(ObjectType, id) obj, NSUInteger idx, BOOL *stop))block;
      //获取与另一个数组中第一个相同的元素的值
      - (M13GenericType(ObjectType, id))firstObjectInCommonWithOrderedDictionary:(M13OrderedDictionary *)otherOrderedDictionary;
      //获取与另一个数组中第一个相同的元素的键
      - (M13GenericType(ObjectType, id<NSCopying>))firstKeyInCommonWithOrderedDictionary:(M13OrderedDictionary *)otherOrderedDictionary;
      //获取与另一个数组中第一个相同的元素
      - (NSDictionary M13Generics(KeyType, ObjectType) *)firstEntryInCommonWithOrderedDictionary:(M13OrderedDictionary *)otherOrderedDictionary;
      //判断两个字典是否相同
      - (BOOL)isEqualToOrderedDictionary:(M13OrderedDictionary *)otherOrderedDictionary;
      //向字典中追加键值对
      - (M13OrderedDictionary M13Generics(KeyType, ObjectType) *)orderedDictionaryByAddingObject:(M13GenericType(ObjectType, id))object pairedWithKey:(M13GenericType(KeyType, id<NSCopying>))aKey;
      - (M13OrderedDictionary M13Generics(KeyType, ObjectType) *)orderedDictionaryByAddingEntry:(NSDictionary M13Generics(KeyType, ObjectType) *)entry;
      //向字典中追加一组键值对
      - (M13OrderedDictionary M13Generics(KeyType, ObjectType) *)orderedDictionaryByAddingObjects:(NSArray M13Generics(ObjectType) *)orderedObjects pairedWithKeys:(NSArray M13Generics(KeyType) *)orderedKeys;
      //筛选元素
      - (M13OrderedDictionary M13Generics(KeyType, ObjectType) *)filteredOrderDictionarysUsingPredicateForObjects:(NSPredicate *)predicate;
      //获取一定范围内的子字典
      - (M13OrderedDictionary M13Generics(KeyType, ObjectType) *)subOrderedDictionaryWithRange:(NSRange)range;
      //进行元素排序相关的方法
      - (M13OrderedDictionary M13Generics(KeyType, ObjectType) *)sortedByObjectsUsingFunction:(NSInteger (*)(M13GenericType(ObjectType, id),M13GenericType(ObjectType, id),void * M13__NULLABLE))comparator context:(M13_NULLABLE void *)context;
      - (M13OrderedDictionary M13Generics(KeyType, ObjectType) *)sortedByKeysUsingFunction:(NSInteger (*)(M13GenericType(KeyType, id<NSCopying>),M13GenericType(KeyType, id<NSCopying>),void * M13__NULLABLE))comparator context:(M13_NULLABLE void *)context;
      - (M13OrderedDictionary M13Generics(KeyType, ObjectType) *)sortedByObjectsUsingFunction:(NSInteger (*)(M13GenericType(ObjectType, id),M13GenericType(ObjectType, id), void * M13__NULLABLE))comparator context:(M13_NULLABLE void *)context hint:(M13_NULLABLE NSData *)hint;
      - (M13OrderedDictionary M13Generics(KeyType, ObjectType) *)sortedByKeysUsingFunction:(NSInteger (*)(M13GenericType(KeyType, id<NSCopying>),M13GenericType(KeyType, id<NSCopying>),void * M13__NULLABLE))comparator context:(M13_NULLABLE void *)context hint:(M13_NULLABLE NSData *)hint;
      - (M13OrderedDictionary M13Generics(KeyType, ObjectType) *)sortedByObjectsUsingDescriptors:(NSArray *)descriptors;
      - (M13OrderedDictionary M13Generics(KeyType, ObjectType) *)sortedByKeysUsingDescriptors:(NSArray *)descriptors;
      - (M13OrderedDictionary M13Generics(KeyType, ObjectType) *)sortedByObjectsUsingSelector:(SEL)comparator;
      - (M13OrderedDictionary M13Generics(KeyType, ObjectType) *)sortedByKeysUsingSelector:(SEL)comparator;
      - (M13OrderedDictionary M13Generics(KeyType, ObjectType) *)sortedByObjectsUsingComparator:(NSComparator)cmptr;
      - (M13OrderedDictionary M13Generics(KeyType, ObjectType) *)sortedByKeysUsingComparator:(NSComparator)cmptr;
      - (M13OrderedDictionary M13Generics(KeyType, ObjectType) *)sortedByObjectsWithOptions:(NSSortOptions)opts usingComparator:(NSComparator)cmptr;
      - (M13OrderedDictionary M13Generics(KeyType, ObjectType) *)sortedByKeysWithOptions:(NSSortOptions)opts usingComparator:(NSComparator)cmptr;
      //写入文件
      - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag;
      //写入到URL
      - (BOOL)writeToURL:(NSURL *)aURL atomically:(BOOL)flag;
      //添加监听
      - (void)addObserver:(NSObject *)anObserver toObjectsAtIndices:(NSIndexSet *)indices forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(M13_NULLABLE void *)context;
      - (void)addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(M13_NULLABLE void *)context;
      //移除监听
      - (void)removeObserver:(NSObject *)anObserver fromObjectsAtIndices:(NSIndexSet *)indices forKeyPath:(NSString *)keyPath;
      - (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath context:(M13_NULLABLE void *)context;
      //KVC相关方法
      - (void)setValue:(M13_NULLABLE id)value forKey:(NSString *)key;
      - (void)setValue:(M13_NULLABLE id)value forKeyPath:(NSString *)keyPath;
      - (id)valueForKey:(NSString *)key;
      - (id)valueForKeyPath:(NSString *)keyPath;
      //归档相关方法
      - (void)encodeWithCoder:(NSCoder *)aCoder;
      - (id)initWithCoder:(NSCoder *)decoder;
      //copy相关方法
      - (id)copy;
      - (id)copyWithZone:(M13_NULLABLE NSZone *)zone;
      - (id)mutableCopy;
      - (id)mutableCopyWithZone:(NSZone *)zone;

      三、M13MutableOrderedDictionary

              基于M13OrderedDictionary,M13MutableOrderedDictionary为可变的有序字典类,其中方法解析如下:

      //类创建方法
      + (instancetype)orderedDictionaryWithCapacity:(NSUInteger)numEntries;
      //初始化方法
      - (id)initWithCapacity:(NSUInteger)numEntries;
      //添加键值对的方法
      - (void)addObject:(M13GenericType(ObjectType, id))object pairedWithKey:(M13GenericType(KeyType, id<NSCopying>))key;
      - (void)addEntry:(NSDictionary M13Generics(KeyType, ObjectType) *)entry;
      - (void)addEntriesFromOrderedDictionary:(M13OrderedDictionary M13Generics(KeyType, ObjectType) *)orderedDictionary;
      - (void)addEntriesFromDictionary:(NSDictionary M13Generics(KeyType, ObjectType) *)dictionary;
      //插入键值对的方法
      - (void)insertObject:(M13GenericType(ObjectType, id))object pairedWithKey:(M13GenericType(KeyType, id<NSCopying>))key atIndex:(NSUInteger)index;
      - (void)insertEntry:(NSDictionary M13Generics(KeyType, ObjectType) *)entry atIndex:(NSUInteger)index;
      - (void)insertEntriesFromOrderedDictionary:(M13OrderedDictionary M13Generics(KeyType, ObjectType) *)orderedDictionary atIndex:(NSUInteger)index;
      - (void)insertEntriesFromDictionary:(NSDictionary M13Generics(KeyType, ObjectType) *)dictionary atIndex:(NSUInteger)index;
      //设置键值对的方法
      - (void)setObject:(M13GenericType(ObjectType, id))object forKey:(M13GenericType(KeyType, id<NSCopying>))aKey;
      - (void)setEntry:(NSDictionary M13Generics(KeyType, ObjectType) *)entry;
      - (void)setEntriesFromOrderedDictionary:(M13OrderedDictionary M13Generics(KeyType, ObjectType) *)orderedDictionary;
      - (void)setEntriesFromDictionary:(NSDictionary M13Generics(KeyType, ObjectType) *)dictionary;
      - (void)setObject:(M13GenericType(ObjectType, id))object forKey:(M13GenericType(KeyType, id<NSCopying>))aKey atIndex:(NSUInteger)index;
      - (void)setEntry:(NSDictionary M13Generics(KeyType, ObjectType) *)entry atIndex:(NSUInteger)index;
      - (void)setEntriesFromOrderedDictionary:(M13OrderedDictionary M13Generics(KeyType, ObjectType) *)orderedDictionary atIndex:(NSUInteger)index;
      - (void)setEntriesFromDictionary:(NSDictionary M13Generics(KeyType, ObjectType) *)dictionary atIndex:(NSUInteger)index;
      //移除键值对的方法
      - (void)removeObjectForKey:(M13GenericType(KeyType, id<NSCopying>))key;
      - (void)removeObjectsForKeys:(NSArray M13Generics(KeyType) *)keys;
      - (void)removeAllObjects;
      - (void)removeAllEntries;
      - (void)removeLastEntry;
      - (void)removeEntryWithObject:(M13GenericType(ObjectType, id))object;
      - (void)removeEntryWithKey:(M13GenericType(KeyType, id<NSCopying>))key;
      - (void)removeEntryWithObject:(M13GenericType(ObjectType, id))object pairedWithKey:(M13GenericType(KeyType, id<NSCopying>))key;
      - (void)removeEntry:(NSDictionary M13Generics(KeyType, ObjectType) *)entry;
      - (void)removeEntryWithObject:(M13GenericType(ObjectType, id))object inRange:(NSRange)range;
      - (void)removeEntryWithKey:(M13GenericType(KeyType, id<NSCopying>))key inRange:(NSRange)range;
      - (void)removeEntryWithObject:(M13GenericType(ObjectType, id))object pairedWithKey:(M13GenericType(KeyType, id<NSCopying>))key inRange:(NSRange)ramge;
      - (void)removeEntry:(NSDictionary M13Generics(KeyType, ObjectType) *)entry inRange:(NSRange)range;
      - (void)removeEntryAtIndex:(NSUInteger)index;
      - (void)removeEntriesAtIndices:(NSIndexSet *)indices;
      - (void)removeEntryWithObjectIdenticalTo:(M13GenericType(ObjectType, id))anObject;
      - (void)removeEntryWithObjectIdenticalTo:(M13GenericType(ObjectType, id))anObject inRange:(NSRange)range;
      - (void)removeEntriesWithObjectsInArray:(NSArray M13Generics(ObjectType) *)array;
      - (void)removeEntriesWithKeysInArray:(NSArray M13Generics(KeyType) *)array;
      - (void)removeEntriesInRange:(NSRange)range;
      //替换键值对的方法
      - (void)replaceEntryAtIndex:(NSInteger)index withObject:(M13GenericType(ObjectType, id))object pairedWithKey:(M13GenericType(KeyType, id<NSCopying>))key;
      - (void)replaceEntryAtIndex:(NSUInteger)index withEntry:(NSDictionary M13Generics(KeyType, ObjectType) *)entry;
      - (void)replaceEntriesAtIndices:(NSIndexSet *)indices
      withObjects:(NSArray M13Generics(ObjectType) *)objects
      pairedWithKeys:(NSArray M13Generics(KeyType) *)keys;
      - (void)replaceEntriesAtIndices:(NSIndexSet *)indices
      withEntries:(NSArray M13Generics(NSDictionary<KeyType, ObjectType> *) *)orderedEntries;
      - (void)replaceEntriesAtIndices:(NSIndexSet *)indices
      withEntriesFromOrderedDictionary:(M13OrderedDictionary M13Generics(KeyType, ObjectType) *)orderedDictionary;
      - (void)replaceEntriesInRange:(NSRange)range
      withObjectsFromArray:(NSArray M13Generics(ObjectType) *)objects
      pairedWithKeysFromArray:(NSArray M13Generics(KeyType) *)keys
      inRange:(NSRange)range2;
      - (void)replaceEntriesInRange:(NSRange)range
      withEntriesFrom:(NSArray M13Generics(NSDictionary<KeyType, ObjectType> *) *)orderedEntries
      inRange:(NSRange)range2;
      - (void)replaceEntriesInRange:(NSRange)range
      withEntriesFromOrderedDictionary:(M13OrderedDictionary M13Generics(KeyType, ObjectType) *)dictionary
      inRange:(NSRange)range2;
      - (void)replaceEntriesInRange:(NSRange)range
      withObjectsFromArray:(NSArray M13Generics(ObjectType) *)objects
      pairedWithKeysFromArray:(NSArray M13Generics(KeyType) *)keys;
      - (void)replaceEntriesInRange:(NSRange)range
      withEntriesFrom:(NSArray M13Generics(NSDictionary<KeyType, ObjectType> *) *)orderedEntries;
      - (void)replaceEntriesInRange:(NSRange)range
      withEntriesFromOrderedDictionary:(M13OrderedDictionary M13Generics(KeyType, ObjectType) *)dictionary;
      - (void)setEntriesToObjects:(NSArray M13Generics(ObjectType) *)objects pairedWithKeys:(NSArray M13Generics(KeyType) *)keys;
      - (void)setEntriesToOrderedDictionary:(M13OrderedDictionary M13Generics(KeyType, ObjectType) *)orderedDictionary;
      //进行元素筛选
      - (void)filterEntriesUsingPredicateForObjects:(NSPredicate *)predicate;
      //进行元素交换
      - (void)exchangeEntryAtIndex:(NSUInteger)idx1 withEntryAtIndex:(NSUInteger)idx2;
      //进行元素排序
      - (void)sortEntriesByObjectUsingDescriptors:(NSArray *)descriptors;
      - (void)sortEntriesByKeysUsingDescriptors:(NSArray *)descriptors;
      - (void)sortEntriesByObjectUsingComparator:(NSComparator)cmptr;
      - (void)sortEntriesByKeysUsingComparator:(NSComparator)cmptr;
      - (void)sortEntriesByObjectWithOptions:(NSSortOptions)opts usingComparator:(NSComparator)cmptr;
      - (void)sortEntriesByKeysWithOptions:(NSSortOptions)opts usingComparator:(NSComparator)cmptr;
      - (void)sortEntriesByObjectUsingFunction:(NSInteger (*)(M13GenericType(ObjectType, id),
      M13GenericType(ObjectType, id),
      void * M13__NULLABLE))compare
      context:(M13_NULLABLE void *)context;
      - (void)sortEntriesByKeysUsingFunction:(NSInteger (*)(M13GenericType(KeyType, id<NSCopying>),
      M13GenericType(KeyType, id<NSCopying>),
      void * M13__NULLABLE))compare
      context:(M13_NULLABLE void *)context;
      - (void)sortEntriesByObjectUsingSelector:(SEL)comparator;
      - (void)sortEntriesByKeysUsingSelector:(SEL)comparator;
      版权声明:本文内容来自第三方投稿或授权转载,原文地址:https://blog.51cto.com/u_11643026/4282425,作者:珲少,版权归原作者所有。本网站转在其作品的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如因作品内容、版权等问题需要同本网站联系,请发邮件至ctyunbbs@chinatelecom.cn沟通。

      上一篇:91分布式电商项目 - SpringTask任务调度框架Cron例子

      下一篇:一次协作多端同步,打通看云、github互相同步(serverless实践)

      相关文章

      2025-03-31 08:48:59

      Flutter 绘图 Paint strokeCap 延伸类型 strokeJoin 拐角类型 图文分析

      Flutter 绘图 Paint strokeCap 延伸类型 strokeJoin 拐角类型 图文分析

      2025-03-31 08:48:59
      Android , iOS , 前端 , 跨平台
      2024-09-25 10:15:32

      iOS中动态更新补丁策略JSPatch运用基础二

      iOS中动态更新补丁策略JSPatch运用基础二

      2024-09-25 10:15:32
      iOS , JavaScript , Objective
      2024-06-25 09:53:21

      iOS开发UI之日期控件的使用(UIDatePicker)

      iOS开发UI之日期控件的使用(UIDatePicker)

      2024-06-25 09:53:21
      iOS , 日期
      2024-06-25 09:53:21

      iOS系统菜单控制器UIMenuController使用简介

      在许多iOS应用中,当用户进行某文字或图片区域的长按操作时,都会弹出一个系统菜单控件,用户可以通过操作菜单控件上的按钮进行数据的复制、剪切、粘贴等操作。

      2024-06-25 09:53:21
      iOS
      2024-06-25 09:53:21

      iOS开发CoreAnimation解读之一——初识CoreAnimation核心动画编程

      众所周知,绚丽动画效果是iOS系统的一大特点,通过UIView层封装的动画,基本已经可以满足我们应用开发的所有需求,但若需要更加自由的控制动画的展示,我们就需要使用CoreAnimation框架中的一些类与方法。这里先附上前几篇与动画相关的博客地址,这一系列,我们抽出其中的CoreAnimation框架来详细解读。

      2024-06-25 09:53:21
      iOS
      2024-06-25 09:53:21

      iOS开发CoreAnimation解读之六——CATransform3D变换的应用

      CATransform3D定义了一个变化矩阵,通过对矩阵参数的设置,我们可以改变layer的一些属性,这个属性的改变,可以产生动画的效果。

      2024-06-25 09:53:21
      iOS
      2024-06-25 09:53:21

      iOS运用runtime全局修改UILabel的默认字体

      iOS运用runtime全局修改UILabel的默认字体

      2024-06-25 09:53:21
      iOS
      2024-06-25 09:53:21

      iOS9新特性——堆叠视图UIStackView

      随着autolayout的推广开来,更多的app开始使用自动布局的方式来构建自己的UI系统,autolayout配合storyBoard和一些第三方的框架,对于创建约束来说,已经十分方便。

      2024-06-25 09:53:21
      iOS
      2024-06-25 09:53:21

      iOS开发中标签控制器的使用——UITabBarController

      与导航控制器相类似,标签控制器也是用于管理视图控制器的一个UI控件,在其内部封装了一个标签栏,与导航不同的是,导航的管理方式是纵向的,采用push与pop切换控制器,标签的管理是横向的,通过标签的切换来改变控制器,一般我们习惯将tabBar作为应用程序的根视图控制器,在其中添加导航,导航中在对ViewController进行管理。

      2024-06-25 09:53:21
      iOS
      2024-06-25 09:53:21

      iOS开发CoreAnimation解读之四——Layer层动画内容

      通过前几篇博客的介绍,我们可以了解到layer层可以设置许多与控件UI相关的属性,并且对于iOS开发,UIView层的属性是会映射到CALayer的,因此,可以通过UIKit和CoreAnimation两个框架来设置控件的UI相关属性,当属性发生变化时,我们可以使其展示一个动画效果。

      2024-06-25 09:53:21
      iOS
      查看更多
      推荐标签

      作者介绍

      天翼云小翼
      天翼云用户

      文章

      33561

      阅读量

      5240754

      查看更多

      最新文章

      iOS开发之CoreTelephoney框架的应用

      2024-06-18 07:22:41

      iOS开发之DeviceCheck框架的应用

      2024-06-18 07:22:41

      iOS文本布局探讨之三——使用TextKit框架进行富文本布局

      2024-06-18 07:22:41

      iOS开发CoreGraphics核心图形框架之一——CGPath的应用

      2024-06-18 07:22:41

      iOS文本布局探讨之二——关于TextKit框架中的字体描述

      2024-06-18 07:22:41

      iOS开发之ExternalAccessory框架的应用

      2024-06-18 07:22:41

      查看更多

      热门文章

      使用iOS原生sqlite3框架对sqlite数据库进行操作

      2023-04-28 02:37:51

      iOS开发之AdSupport框架使用

      2024-03-28 09:00:50

      iOS开发之CoreTelephoney框架的应用

      2024-06-18 07:22:41

      iOS文本布局探讨之二——关于TextKit框架中的字体描述

      2024-06-18 07:22:41

      iOS文本布局探讨之三——使用TextKit框架进行富文本布局

      2024-06-18 07:22:41

      iOS开发之EventKit框架的应用

      2024-06-04 10:11:19

      查看更多

      热门标签

      客户端 实践 基础知识 Java 服务器 java 数据库 框架 python 服务端 学习 代码 简单 javascript 编程
      查看更多

      相关产品

      弹性云主机

      随时自助获取、弹性伸缩的云服务器资源

      天翼云电脑(公众版)

      便捷、安全、高效的云电脑服务

      对象存储

      高品质、低成本的云上存储服务

      云硬盘

      为云上计算资源提供持久性块存储

      查看更多

      随机文章

      iOS开发CoreGraphics核心图形框架之二——深入理解图形上下文

      iOS开发之DeviceCheck框架的应用

      iOS开发之ExternalAccessory框架的应用

      iOS文本布局探讨之三——使用TextKit框架进行富文本布局

      使用iOS原生sqlite3框架对sqlite数据库进行操作

      iOS开发之EventKit框架的应用

      • 7*24小时售后
      • 无忧退款
      • 免费备案
      • 专家服务
      售前咨询热线
      400-810-9889转1
      关注天翼云
      • 旗舰店
      • 天翼云APP
      • 天翼云微信公众号
      服务与支持
      • 备案中心
      • 售前咨询
      • 智能客服
      • 自助服务
      • 工单管理
      • 客户公告
      • 涉诈举报
      账户管理
      • 管理中心
      • 订单管理
      • 余额管理
      • 发票管理
      • 充值汇款
      • 续费管理
      快速入口
      • 天翼云旗舰店
      • 文档中心
      • 最新活动
      • 免费试用
      • 信任中心
      • 天翼云学堂
      云网生态
      • 甄选商城
      • 渠道合作
      • 云市场合作
      了解天翼云
      • 关于天翼云
      • 天翼云APP
      • 服务案例
      • 新闻资讯
      • 联系我们
      热门产品
      • 云电脑
      • 弹性云主机
      • 云电脑政企版
      • 天翼云手机
      • 云数据库
      • 对象存储
      • 云硬盘
      • Web应用防火墙
      • 服务器安全卫士
      • CDN加速
      热门推荐
      • 云服务备份
      • 边缘安全加速平台
      • 全站加速
      • 安全加速
      • 云服务器
      • 云主机
      • 智能边缘云
      • 应用编排服务
      • 微服务引擎
      • 共享流量包
      更多推荐
      • web应用防火墙
      • 密钥管理
      • 等保咨询
      • 安全专区
      • 应用运维管理
      • 云日志服务
      • 文档数据库服务
      • 云搜索服务
      • 数据湖探索
      • 数据仓库服务
      友情链接
      • 中国电信集团
      • 189邮箱
      • 天翼企业云盘
      • 天翼云盘
      ©2025 天翼云科技有限公司版权所有 增值电信业务经营许可证A2.B1.B2-20090001
      公司地址:北京市东城区青龙胡同甲1号、3号2幢2层205-32室
      • 用户协议
      • 隐私政策
      • 个人信息保护
      • 法律声明
      备案 京公网安备11010802043424号 京ICP备 2021034386号