PDMessage

Inherits from: NSObject
Conforms to: NSCoding

Overview

消息类,用于描述一条消息数据

Propertys

  • 消息ID

@property (nonatomic, assign) int msgId;

  • 消息发送时间

@property (nonatomic, strong) NSDate* sendTime;

  • 消息收发方向

@property (nonatomic, assign) PDMessageDirection direction;

  • 消息体类型

@property (nonatomic, assign) PDMessageContentType contentType;

  • 消息体,实际会根据contentType放入PDMessageContent的子类对象

@property (nonatomic, strong) PDMessageContent* content;

Methods

  • 初始化方法
- (id)initWithDirection:(PDMessageDirection)direction
         andContentType:(PDMessageContentType)contentType
      andMessageContent:(PDMessageContent*)content;
参数 类型 说明
direction PDMessageDirection 消息发送时间
contentType PDMessageContentType 消息体类型
content PDMessageContent* 消息体
返回值 id 初始化后的对象指针
  • 初始化方法
- (id)initWithId:(int)msgId
     andSendTime:(NSDate*)sendTime
    andDirection:(PDMessageDirection)direction
  andContentType:(PDMessageContentType)contentType
andMessageContent:(PDMessageContent*)content;
参数 类型 说明
msgId int 消息ID
sendTime NSDate* 消息发送时间
direction PDMessageDirection 消息发送时间
contentType PDMessageContentType 消息体类型
content PDMessageContent* 消息体
返回值 id 初始化后的对象指针
  • 消息类型转字符串
+ (NSString*)contentTypeToString:(PDMessageContentType)type;
参数 类型 说明
type PDMessageContentType 消息类型枚举
返回值 NSString* 消息类型字符串
  • 字符串转消息类型
+ (PDMessageContentType)contentTypeFromString:(NSString*)type;
参数 类型 说明
type NSString* 消息类型字符串
返回值 PDMessageContentType 消息类型枚举

results matching ""

    No results matching ""