Joke Collection Website - Blessing messages - Tencent Cloud Instant Messaging (3)-----Customized Messages
Tencent Cloud Instant Messaging (3)-----Customized Messages
Tencent Cloud IM’s SDK mainly provides the following message classes
TIMTextElem? (text message)
TIMImageElem? (picture message)
TIMFileElem? (File message)
TIMSoundElem (Voice message)
TIMLocationElem? (Geographical location)
TIMFaceElem? (Emoticon message type)
TIMVideoElem (micro video message)
TIMUGCElem? (UGC video)
Generally speaking, these message types can meet our needs, but products and bosses only It's the boss. They have made the plan, and the hard-working programmers have to work hard to implement it.
This is when custom messages come in handy. Let's take a look at this custom message class first. ? TIMCustomElem
It is obvious from the comments that one of the attributes is of NSData type?, that is, we need to convert the custom message encapsulation into NSData and pass it over.
According to the poster's needs It is necessary to customize a message to display order information. It is necessary to display the contact information of the orderer, address information consignee, product pictures, product price, product name and other information
Construction process
The format of the constructed message body is
In this way, the custom message insertion is successful, but in order to correctly display the custom message on the interface, a cell class for message display must be customized
p>We add a class ChatCustomOrderTableViewCell to ChatTableViewCell and let it inherit from ChatBaseTableViewCell
//Then implement this class
//The pitfall encountered is that it was used when setting constraints before The layout has always been incorrect compared to the sibling controls. Later, this rigid layout was adopted to meet the requirements. . .
- Related articles
- Classic story joke
- How many minutes does it take to leave immediately by SMS?
- Can the standard of SMS notification 50 of Postal Savings Bank be changed?
- What about China Mobile's arbitrary deduction?
- Good evening, greetings.
- Apple phones always receive spam messages from email addresses (pictured). Because the addresses are different every time, it is useless to intercept them with software.
- How to turn on the caller ID of mobile phone through SMS (Shandong) Thank you! o(∩_∩)o
- The intersection of Yuquan Road in Xianyang ran a red light.
- Why don't you use the verification code to log in to my king?
- Interpretation of professional terms from primary school to junior high school