TUIChat
The following content will show you how to set chat interface self Definition options.
Message list
Set background color and image
API's function: Set the chat interface message list background color and background image, effective for all chat interfaces.
API prototype:
// TUIChatConfig_Minimalist.h/*** Customize the backgroud color of message list interface.* This configuration takes effect in all message list interfaces.*/@property (nonatomic, strong) UIColor *backgroudColor;/*** Customize the backgroud image of message list interface.* This configuration takes effect in all message list interfaces.*/@property (nonatomic, strong) UIImage *backgroudImage;
Sample code:
// When to call: Before initializing the message list interface.[TUIChatConfig_Minimalist sharedConfig].backgroudColor = [UIColor tui_colorWithHex:@"#E1FFFF"];[TUIChatConfig_Minimalist sharedConfig].backgroudImage = [UIImage imageNamed:@"your_background_image"];
Result:
Set Background Color | Set Background Image | Default |
| | |
Set user avatar and corner radius
API Function: Sets the user avatar type and corner radius. Currently supported types are rectangle, circle, rounded rectangle. Only the rounded rectangle type uses the corner radius. Effective for the message list, conversation list, and contact list.
API prototype:
// TUIChatConfig_Minimalist.htypedef NS_ENUM(NSInteger, TUIAvatarStyle) {TUIAvatarStyleRectangle,TUIAvatarStyleCircle,TUIAvatarStyleRoundedRectangle,};/*** Customize the style of avatar.* The default value is TUIAvatarStyleCircle.* This configuration takes effect in all avatars.*/@property (nonatomic, assign) TUIAvatarStyle avatarStyle;/*** Customize the corner radius of the avatar.* This configuration takes effect in all avatars.*/@property (nonatomic, assign) CGFloat avatarCornerRadius;
Sample code:
// When to call: Before initializing the TUIKit interfaces.[TUIChatConfig_Minimalist sharedConfig].avatarStyle = TUIAvatarStyleRectangle;// Set cornerRadius[TUIChatConfig_Minimalist sharedConfig].avatarStyle = TUIAvatarStyleRoundedRectangle;[TUIChatConfig_Minimalist sharedConfig].avatarCornerRadius = 10;
Result:
Default circular avatar | Set rounded rectangle avatar | Set rectangular avatar |
| | |
Enable group grid avatar
API Function: Set group avatar to display as nine-grid. Effective for message lists, conversation lists, and contact lists.
API prototype:
// TUIChatConfig_Minimalist.h/*** Display the group avatar in the nine-square grid style.* The default value is YES.* This configuration takes effect in all groups.*/@property (nonatomic, assign) BOOL enableGroupGridAvatar;
Sample code:
// When to call: Before initializing the TUIKit interfaces.[TUIChatConfig_Minimalist sharedConfig].enableGroupGridAvatar = NO;
Result:
Disable group avatar as nine-grid | Default |
| |
Enable typing indicator
API function: Enable the "typing" indicator. Effective for all 1v1 chat message interfaces.
API prototype:
// TUIChatConfig_Minimalist.h/*** Enable the display "Alice is typing..." on one-to-one chat interface.* The default value is YES.* This configuration takes effect in all one-to-one chat message list interfaces.*/@property (nonatomic, assign) BOOL enableTypingIndicator;
Sample code:
// When to call: Before initializing the message list interface.[TUIChatConfig_Minimalist sharedConfig].enableTypingIndicator = NO;
Result:
Enable "Typing" | Disable "Typing" |
| |
Enable message read receipt
API function: Enable read receipt. Once enabled, read information can be viewed in message details. Effective for all messages.
API prototype:
// TUIChatConfig_Minimalist.h/*** When sending a message, set this flag to require message read receipt.* The default value is NO.* This configuration takes effect in all chat message list interfaces.*/@property (nonatomic, assign) BOOL isMessageReadReceiptNeeded;
Sample code:
// When to call: Before sending messages.[TUIChatConfig_Minimalist sharedConfig].isMessageReadReceiptNeeded = YES;
Result:
Enable read receipt | Disable read receipt |
| |
Hide long-press message menu button
API's function: Hide specified buttons in the long-press message menu, effective for all chat messages.
API prototype:
// TUIChatConfig_Minimalist.htypedef NS_OPTIONS(NSInteger, TUIChatItemWhenLongPressMessage_Minimalist) {TUIChatItemWhenLongPressMessage_Minimalist_None = 0,TUIChatItemWhenLongPressMessage_Minimalist_Reply = 1 << 0,TUIChatItemWhenLongPressMessage_Minimalist_EmojiReaction = 1 << 1,TUIChatItemWhenLongPressMessage_Minimalist_Quote = 1 << 2,TUIChatItemWhenLongPressMessage_Minimalist_Pin = 1 << 3,TUIChatItemWhenLongPressMessage_Minimalist_Recall = 1 << 4,TUIChatItemWhenLongPressMessage_Minimalist_Translate = 1 << 5,TUIChatItemWhenLongPressMessage_Minimalist_Convert = 1 << 6,TUIChatItemWhenLongPressMessage_Minimalist_Forward = 1 << 7,TUIChatItemWhenLongPressMessage_Minimalist_Select = 1 << 8,TUIChatItemWhenLongPressMessage_Minimalist_Copy = 1 << 9,TUIChatItemWhenLongPressMessage_Minimalist_Delete = 1 << 10,TUIChatItemWhenLongPressMessage_Minimalist_Info = 1 << 11,};/*** Hide the items in the pop-up menu when user presses the message.*/+ (void)hideItemsWhenLongPressMessage:(TUIChatItemWhenLongPressMessage_Minimalist)items;
Sample code:
// When to call: Before displaying the pop-up menu when user presses the message.[TUIChatConfig_Minimalist hideItemsWhenLongPressMessage:TUIChatItemWhenLongPressMessage_Minimalist_Reply|TUIChatItemWhenLongPressMessage_Minimalist_Recall|TUIChatItemWhenLongPressMessage_Minimalist_Select];
Result:
Do not hide any buttons | Hide the Forward button |
| |
Hide video and audio call button
API's function: Hide the audio and video call buttons at the top of the message list, effective for all chat message interfaces.
API prototype:
// TUIChatConfig_Minimalist.h/*** Hide the "Video Call" button in the message list header.* The default value is NO.*/@property (nonatomic, assign) BOOL hideVideoCallButton;/*** Hide the "Audio Call" button in the message list header.* The default value is NO.*/@property (nonatomic, assign) BOOL hideAudioCallButton;
Sample code:
// When to call: Before entering the message list interface.[TUIChatConfig_Minimalist sharedConfig].hideVideoCallButton = YES;[TUIChatConfig_Minimalist sharedConfig].hideAudioCallButton = YES;
Result:
Hide video call button | Hide audio call button | Default Value |
| |
|
Enable floating window for call
API's function: Enable the audio and video call floating window. If enabled, you can float the audio and video call interface in a small window on the chat interface. Effective for all audio and video call interfaces.
API prototype:
// TUIChatConfig_Minimalist.h/*** Turn on audio and video call floating windows,* The default value is YES.*/@property (nonatomic, assign) BOOL enableFloatWindowForCall;
Sample code:
// When to call: Before entering the message list interface.[TUIChatConfig_Minimalist sharedConfig].enableFloatWindowForCall = NO;
Enable multi-device login for call
API's function: Enable multi-device log in for audio and video calls, effective for all audio and video calls.
API prototype:
// TUIChatConfig_Minimalist.h/*** Enable multi-terminal login function for audio and video calls* The default value is NO.*/@property (nonatomic, assign) BOOL enableMultiDeviceForCall;
Sample code:
// When to call: Before entering the message list interface.[TUIChatConfig_Minimalist sharedConfig].enableMultiDeviceForCall = YES;
Set custom top view
API's function: Set a custom view at the top of the chat interface, effective for all chat message interfaces.
API prototype:
// TUIChatConfig_Minimalist.h/*** Add a custom view at the top of the chat interface.* This view will be displayed at the top of the message list and will not slide up.*/+ (void)setCustomTopView:(UIView *)view;
Sample code:
// When to call: Before initializing the message list interface.// tipsView is your customized view.[TUIChatConfig_Minimalist setCustomTopView:tipsView];
Result:
Set custom view | Default |
| |
Set not to update the unread count
API function: Set the upcoming message to not update the conversation unread count. Effective for all messages.
API prototype:
// TUIChatConfig_Minimalist.h/*** Set this parameter when the sender sends a message, and the receiver will not update the unread count after receiving the message.* The default value is NO.*/@property (nonatomic, assign) BOOL isExcludedFromUnreadCount;
Sample code:
// When to call: Before sending messages.[TUIChatConfig_Minimalist sharedConfig].isExcludedFromUnreadCount = YES;
Set not to update the conversation lastMsg
API function: Set the upcoming message to not update the conversation lastMsg. Effective for all messages.
API prototype:
// TUIChatConfig_Minimalist.h/*** Set this parameter when the sender sends a message, and the receiver will not update the last message of the conversation after receiving the message.* The default value is NO.*/@property (nonatomic, assign) BOOL isExcludedFromLastMessage;
Sample code:
// When to call: Before sending messages.[TUIChatConfig_Minimalist sharedConfig].isExcludedFromLastMessage = YES;
Set message recall interval
API function: Set message recall time interval, effective for all messages.
API prototype:
// TUIChatConfig_Minimalist.h/*** Time interval within which a message can be recalled after being sent.* The default value is 120 seconds.* If you want to adjust this configuration, please modify the setting on Chat Console synchronously: https://trtc.io/document/34419?platform=web&product=chat&menulabel=uikit#message-recall-settings*/@property (nonatomic, assign) NSUInteger timeIntervalForAllowedMessageRecall;
Sample code:
// When to call: Before sending messages.[TUIChatConfig_Minimalist sharedConfig].timeIntervalForAllowedMessageRecall = 90;
Set maximum recording duration for voice and video messages
API function: Set the maximum recording duration for voice and video messages, effective for all voice and video messages.
API prototype:
// TUIChatConfig_Minimalist.h/*** Maximum audio recording duration, no more than 60s.* The default value is 60 seconds.*/@property (nonatomic, assign) CGFloat maxAudioRecordDuration;/*** Maximum video recording duration, no more than 15s.* The default value is 15 seconds.*/@property (nonatomic, assign) CGFloat maxVideoRecordDuration;
Sample code:
// When to call: Before recording audio or video messages.[TUIChatConfig_Minimalist sharedConfig].maxAudioRecordDuration = 10;[TUIChatConfig_Minimalist sharedConfig].maxVideoRecordDuration = 10;
Enable custom ringtones
API function: Set the ringtone on Android devices to a built-in custom ringtone upon receiving a message, effective for all messages.
API prototype:
// TUIChatConfig_Minimalist.h/*** Enable custom ringtone.* This config takes effect only for Android devices.*/@property (nonatomic, assign) BOOL enableAndroidCustomRing;
Sample code:
// When to call: Before sending messages.[TUIChatConfig_Minimalist sharedConfig].enableAndroidCustomRing = YES;
Set to play voice messages using loudspeakers by default
API's function: Set the default playback for voice message to use the speaker instead of the earpiece. Effective for all voice messages.
API prototype:
// TUIChatConfig_Minimalist.h/*** Call this method to use speakers instead of handsets by default when playing voice messages.*/+ (void)setPlayingSoundMessageViaSpeakerByDefault;
Sample code:
// When to call: Before initializing the Message interface.[TUIChatConfig_Minimalist setPlayingSoundMessageViaSpeakerByDefault];
Register custom message
API's function: Register custom Definition messages. Please refer to the documentation for usage scenarios Add custom messages.
API prototype:
// TUIChatConfig_Minimalist.h/*** Register custom message.* - Parameters:* - businessID: Customized message‘s businessID, which is unique.* - cellName: Customized message's MessagCell class name.* - cellDataName: Customized message's MessagCellData class name.*/- (void)registerCustomMessage:(NSString *)businessIDmessageCellClassName:(NSString *)cellNamemessageCellDataClassName:(NSString *)cellDataName;
Sample code:
// When to call: Before initializing the Message List interface.[[TUIChatConfig_Minimalist sharedConfig] registerCustomMessage:BussinessID_TextLinkmessageCellClassName:@"TUILinkCell"messageCellDataClassName:@"TUILinkCellData"];
Customize events when click and long press the user avatar
API's function: Event callback for user clicks and long presses on the user avatar in the message list.
API prototype:
// TUIChatConfig_Minimalist.h@protocol TUIChatConfigDelegate_Minimalist <NSObject>/*** Tells the delegate a user's avatar in the chat list is clicked.* Returning YES indicates this event has been intercepted, and Chat will not process it further.* Returning NO indicates this event is not intercepted, and Chat will continue to process it.*/- (BOOL)onUserAvatarClicked:(UIView *)view messageCellData:(TUIMessageCellData *)celldata;/*** Tells the delegate a user's avatar in the chat list is long pressed.* Returning YES indicates that this event has been intercepted, and Chat will not process it further.* Returning NO indicates that this event is not intercepted, and Chat will continue to process it.*/- (BOOL)onUserAvatarLongPressed:(UIView *)view messageCellData:(TUIMessageCellData *)celldata;@end
Sample code:
[TUIChatConfig_Minimalist sharedConfig].delegate = self;// TUIChatConfigDelegate_Minimalist- (BOOL)onUserAvatarClicked:(UIView *)view messageCellData:(TUIMessageCellData *)celldata {// Customize your own action when user avatar is clicked.NSLog(@"onUserAvatarClicked, cellData: %@", celldata);return YES;}- (BOOL)onUserAvatarLongPressed:(UIView *)view messageCellData:(TUIMessageCellData *)celldata {// Customize your own action when user avatar is long pressed.NSLog(@"onUserAvatarLongPressed, cellData: %@", celldata);return YES;}
Customize events when click and long press the message
API's function: Event callback for user clicks and long presses on messages in the message list.
API prototype:
// TUIChatConfig_Minimalist.h@protocol TUIChatConfigDelegate_Minimalist <NSObject>/*** Tells the delegate a message in the chat list is clicked.* Returning YES indicates that this event has been intercepted, and Chat will not process it further.* Returning NO indicates that this event is not intercepted, and Chat will continue to process it.*/- (BOOL)onMessageClicked:(UIView *)view messageCellData:(TUIMessageCellData *)celldata;/*** Tells the delegate a message in the chat list is long pressed.* Returning YES indicates that this event has been intercepted, and Chat will not process it further.* Returning NO indicates that this event is not intercepted, and Chat will continue to process it.*/- (BOOL)onMessageLongPressed:(UIView *)view messageCellData:(TUIMessageCellData *)celldata;@end
Sample code:
[TUIChatConfig_Minimalist sharedConfig].delegate = self;// TUIChatConfigDelegate_Minimalist- (BOOL)onMessageClicked:(UIView *)view messageCellData:(TUIMessageCellData *)celldata {// Customize your own action when message is clicked.NSLog(@"onMessageClicked, cellData: %@", celldata);return YES;}- (BOOL)onMessageLongPressed:(UIView *)view messageCellData:(TUIMessageCellData *)celldata {// Customize your own action when message is long pressed.NSLog(@"onMessageLongPressed, cellData: %@", celldata);return YES;}
Message Style
Set the style of text messages
API's function: Set the text color and font for sent and received text messages. Effective for all text messages.
API prototype:
// TUIChatConfig_Minimalist.h/*** The color of send text message.*/@property(nonatomic, assign) UIColor *sendTextMessageColor;/*** The font of send text message.*/@property(nonatomic, assign) UIFont *sendTextMessageFont;/** The color of receive text message.*/@property(nonatomic, assign) UIColor *receiveTextMessageColor;/*** The font of receive text message.*/@property(nonatomic, assign) UIFont *receiveTextMessageFont;
Sample code:
// When to call: After initializing the message list interface and before entering it.[TUIChatConfig_Minimalist sharedConfig].sendTextMessageColor = [UIColor tui_colorWithHex:@"#00BFFF"];[TUIChatConfig_Minimalist sharedConfig].sendTextMessageFont = [UIFont systemFontOfSize:20];[TUIChatConfig_Minimalist sharedConfig].receiveTextMessageColor = [UIColor tui_colorWithHex:@"#2E8B57"];[TUIChatConfig_Minimalist sharedConfig].receiveTextMessageFont = [UIFont systemFontOfSize:20];
Result:
Set text message color | Set text message font | Default |
| | |
Set the style of system messages
API's function: Set the font, color, and background color of system notification messages. Effective for all system notification messages.
API prototype:
// TUIChatConfig_Minimalist.h/*** The text color of system message.*/@property (nonatomic, strong) UIColor *systemMessageTextColor;/*** The font of system message.*/@property (nonatomic, strong) UIFont *systemMessageTextFont;/*** The background color of system message.*/@property (nonatomic, strong) UIColor *systemMessageBackgroundColor;
Sample code:
// When to call: After initializing the message list interface and before entering it.[TUIChatConfig_Minimalist sharedConfig].systemMessageTextColor = [UIColor tui_colorWithHex:@"#FF8C00"];[TUIChatConfig_Minimalist sharedConfig].systemMessageTextFont = [UIFont systemFontOfSize:24];[TUIChatConfig_Minimalist sharedConfig].systemMessageBackgroundColor = [UIColor tui_colorWithHex:@"#F0FFF0"];
Result:
Set the font, color, and background color of system notification messages | Default |
| |
Message Layout
Set the message layout
API's function: Set the layout for various types of messages, effective for specified messages.
API prototype:
// TUIMessageCellLayout.h@interface TUIMessageCellLayout : NSObject/*** The insets of message*/@property(nonatomic, assign) UIEdgeInsets messageInsets;/*** The insets of bubble content.*/@property(nonatomic, assign) UIEdgeInsets bubbleInsets;/*** The insets of avatar*/@property(nonatomic, assign) UIEdgeInsets avatarInsets;/*** The size of avatar*/@property(nonatomic, assign) CGSize avatarSize;@end// TUIChatConfig_Minimalist.h/*** Text message cell layout of my sent message.*/@property(nonatomic, assign, readonly) TUIMessageCellLayout *sendTextMessageLayout;/*** Text message cell layout of my received message.*/@property(nonatomic, assign, readonly) TUIMessageCellLayout *receiveTextMessageLayout;/*** Image message cell layout of my sent message.*/@property(nonatomic, assign, readonly) TUIMessageCellLayout *sendImageMessageLayout;/*** Image message cell layout of my received message.*/@property(nonatomic, assign, readonly) TUIMessageCellLayout *receiveImageMessageLayout;/*** Voice message cell layout of my sent message.*/@property(nonatomic, assign, readonly) TUIMessageCellLayout *sendVoiceMessageLayout;/*** Voice message cell layout of my received message.*/@property(nonatomic, assign, readonly) TUIMessageCellLayout *receiveVoiceMessageLayout;/*** Video message cell layout of my sent message.*/@property(nonatomic, assign, readonly) TUIMessageCellLayout *sendVideoMessageLayout;/*** Video message cell layout of my received message.*/@property(nonatomic, assign, readonly) TUIMessageCellLayout *receiveVideoMessageLayout;/*** Other message cell layout of my sent message.*/@property(nonatomic, assign, readonly) TUIMessageCellLayout *sendMessageLayout;/*** Other message cell layout of my received message.*/@property(nonatomic, assign, readonly) TUIMessageCellLayout *receiveMessageLayout;/*** System message cell layout.*/@property(nonatomic, assign, readonly) TUIMessageCellLayout *systemMessageLayout;
Sample code:
// When to call: After initializing the message list interface and before entering it.// TextMesssageLayout[TUIChatConfig_Minimalist sharedConfig].receiveTextMessageLayout.bubbleInsets = UIEdgeInsetsMake(30, 30, 30, 30);[TUIChatConfig_Minimalist sharedConfig].sendTextMessageLayout.avatarInsets = UIEdgeInsetsMake(30, 0, 0, 30);[TUIChatConfig_Minimalist sharedConfig].sendTextMessageLayout.bubbleInsets = UIEdgeInsetsMake(0, 0, 10, 20);
Result:
Set the avatar size | Set the avatar inset | Set bubble inset |
| | |
Message bubble
Enable message bubble display
API's function: Enable message bubble display, effective for all chat interfaces.
API prototype:
// TUIChatConfig_Minimalist.h/*** Enable the message display in the bubble style.* The default value is YES.*/@property(nonatomic, assign) BOOL enableMessageBubbleStyle;
Sample code:
// When to call: After initializing the message list interface and before entering it.[TUIChatConfig_Minimalist sharedConfig].enableMessageBubbleStyle = NO;
Result:
Do not display message bubbles | Default |
| |
Set bubble background image
API's function: Set bubble background images, effective for all chat interfaces.
API prototype:
// TUIChatConfig_Minimalist.h/*** Set the background image of the last sent message bubble in consecutive messages.*/@property (nonatomic, strong) UIImage *sendLastBubbleBackgroundImage;/*** Set the background image of the non-last sent message bubble in consecutive message.*/@property (nonatomic, strong) UIImage *sendBubbleBackgroundImage;/*** Set the background image of the sent message bubble in highlight status.*/@property (nonatomic, strong) UIImage *sendHighlightBubbleBackgroundImage;/*** Set the light background image when the sent message bubble needs to flicker.*/@property (nonatomic, strong) UIImage *sendAnimateLightBubbleBackgroundImage;/*** Set the dark background image when the sent message bubble needs to flicker.*/@property (nonatomic, strong) UIImage *sendAnimateDarkBubbleBackgroundImage;/*** Set the background image of the last received message bubble in consecutive message.*/@property (nonatomic, strong) UIImage *receiveLastBubbleBackgroundImage;/*** Set the background image of the non-last received message bubble in consecutive message.*/@property (nonatomic, strong) UIImage *receiveBubbleBackgroundImage;/*** Set the background image of the received message bubble in highlight status.*/@property (nonatomic, strong) UIImage *receiveHighlightBubbleBackgroundImage;/*** Set the light background image when the received message bubble needs to flicker.*/@property (nonatomic, strong) UIImage *receiveAnimateLightBubbleBackgroundImage;/*** Set the dark background image when the received message bubble needs to flicker.*/@property (nonatomic, strong) UIImage *receiveAnimateDarkBubbleBackgroundImage;
Sample code:
// When to call: After initializing the message list interface and before entering it.[TUIChatConfig_Minimalist sharedConfig].sendLastBubbleBackgroundImage = [UIImage imageNamed:@"SenderTextNodeBkg@3x.png"];[TUIChatConfig_Minimalist sharedConfig].sendBubbleBackgroundImage = [UIImage imageNamed:@"SenderTextNodeBkg_Same@3x.png"];[TUIChatConfig_Minimalist sharedConfig].receiveLastBubbleBackgroundImage = [UIImage imageNamed:@"ReceiverTextNodeBkg@3x.png"];[TUIChatConfig_Minimalist sharedConfig].receiveBubbleBackgroundImage = [UIImage imageNamed:@"ReceiverTextNodeBkg_Same@3x.png"];
Result:
Set bubble background image | Default |
| |
Input bar
Display Input bar
API's function: Display the input box in the chat interface, effective for all chat interfaces.
API prototype:
// TUIChatConfig_Minimalist.h/*** Show the input bar in the message list interface.* The default value is YES.*/@property(nonatomic, assign) BOOL showInputBar;
Sample code:
// When to call: After initializing the message list interface and before entering it.[TUIChatConfig_Minimalist sharedConfig].showInputBar = NO;
Result:
Hide input bar | Default |
| |
Hide options in more menu (global)
API's function: Hide buttons in the more menu, effective for all chat interfaces.
API prototype:
// TUIChatConfig_Minimalist.h/*** Hide items in more menu.*/+ (void)hideItemsInMoreMenu:(TUIChatInputBarMoreMenuItem_Minimalist)items;
Sample code:
// When to call: After initializing the message list interface and before entering it.// Timing of invocation: After initializing the chat interface, before entering the chat interface[TUIChatConfig_Minimalist hideItemsInMoreMenu:TUIChatInputBarMoreMenuItem_Minimalist_CustomMessage|TUIChatInputBarMoreMenuItem_Minimalist_RecordVideo|TUIChatInputBarMoreMenuItem_Minimalist_File];
Result:
Hide part of the options | Default |
| |
Hide options in the more menu (local)
API's function: Hide buttons in the more menu, effective for specified chat interfaces.
API prototype:
// TUIChatConfig_Minimalist.h@protocol TUIChatInputBarConfigDataSource_Minimalist <NSObject>- (NSInteger)inputBarShouldHideItemsInMoreMenuOfModel:(TUIChatConversationModel *)model;@end
Sample code:
// When to call: After initializing the message list interface and before entering it.[TUIChatConfig_Minimalist sharedConfig].inputBarDataSource = self;// TUIChatInputBarConfigDataSource_Minimalist- (NSInteger)inputBarShouldHideItemsInMoreMenuOfModel:(TUIChatConversationModel *)model {if ([model.groupID isEqualToString:@"your target groupID"]) {return TUIChatInputBarMoreMenuItem_Minimalist_CustomMessage|TUIChatInputBarMoreMenuItem_Minimalist_RecordVideo|TUIChatInputBarMoreMenuItem_Minimalist_File;}return TUIChatInputBarMoreMenuItem_Minimalist_None;}
Add options to the more menu (local)
API's function: Add options to the more menu, effective for specified chat interfaces.
API prototype:
// TUIChatConfig_Minimalist.h@protocol TUIChatInputBarConfigDataSource_Minimalist <NSObject>- (NSArray<TUICustomActionSheetItem *> *)inputBarShouldAddNewItemsToMoreMenuOfModel:(TUIChatConversationModel *)model;@end
Sample code:
// When to call: After initializing the message list interface and before entering it.[TUIChatConfig_Minimalist sharedConfig].inputBarDataSource = self;// TUIChatInputBarConfigDataSource_Minimalist- (NSArray<TUICustomActionSheetItem *> *)inputBarShouldAddNewItemsToMoreMenuOfModel:(TUIChatConversationModel *)model {// Priority is highest so item1 will be added to the top.TUICustomActionSheetItem *item1 = [TUICustomActionSheetItem new];item1.priority = 10000;item1.title = @"item1";item1.leftMark = [UIImage imageNamed:@"example_img@3x.png"];item1.actionStyle = UIAlertActionStyleDefault;item1.actionHandler = ^(UIAlertAction * _Nonnull action) {NSLog(@"item1 is clicked");};// item2 will be added to the bottom above the "Custom" item.TUICustomActionSheetItem *item2 = [[TUICustomActionSheetItem alloc] initWithTitle:@"item2" leftMark:[UIImage imageNamed:@"example_img@3x.png"] withActionHandler:^(UIAlertAction * _Nonnull action) {NSLog(@"item2 is clicked");}];return @[item1, item2];}
Result:
Adding item | Default |
| |
Add emoji group
API function: Add emoji groups to the emoji menu, effective across all chat interfaces. For use cases, please refer to the documentation Adding Custom Emojis.
API prototype:
// TUIChatConfig_Minimalist.h/*** Add sticker group.*/- (void)addStickerGroup:(TUIFaceGroup *)group;
Sample code:
// When to call: After initializing the message list interface and before entering it.TUIFaceGroup *group4350 = [[TUIFaceGroup alloc] init];group4350.groupIndex = 1;group4350.groupPath = [bundlePath stringByAppendingPathComponent:@"4350/"];group4350.faces = faces4350;group4350.rowCount = 2;group4350.itemCountPerRow = 5;group4350.menuPath = [bundlePath stringByAppendingPathComponent:@"4350/menu"];[[TUIChatConfig_Minimalist sharedConfig] addStickerGroup:group4350];
- Message list
- Set background color and image
- Set user avatar and corner radius
- Enable group grid avatar
- Enable typing indicator
- Enable message read receipt
- Hide long-press message menu button
- Hide video and audio call button
- Enable floating window for call
- Enable multi-device login for call
- Set custom top view
- Set not to update the unread count
- Set not to update the conversation lastMsg
- Set message recall interval
- Set maximum recording duration for voice and video messages
- Enable custom ringtones
- Set to play voice messages using loudspeakers by default
- Register custom message
- Customize events when click and long press the user avatar
- Customize events when click and long press the message
- Message Style
- Message Layout
- Message bubble
- Input bar