• UIKit
  • SDK
  • RESTful API
Chat/
UIKit/
iOS and macOS/
Build Basic Interfaces/
UIKit
  • Overview
    • TUIKit Introduction
    • Features Overview
    • Pricing
      • Billing Overview
      • Chat Monthly Package
      • Billing of Chat Out-of-Package Usage
  • Getting Started
    • Run Demo
    • Sending your first message
    • Installation
      • TUIKit
      • TUIChat Only
    • Secure authentication with UserSig
  • Build Basic Interfaces
    • Chat
    • Conversation List
    • Contact List
    • Add Contact
    • Create Group Chat
    • Video and Audio Call
  • Features
    • Reactions
    • Quote
    • Read Receipt
    • User Online Status
    • Translation
    • Search Messages
    • Integrating Offline Push
      • Manufacturer configuration
      • Quick Integration
      • Client APIs
  • Customization
    • Customize Styles
      • Global
      • Chat
      • Conversation List
      • Group Settings
      • Contact Settings
    • Customize Messages
    • Customize Emojis and Stickers
  • Localization
  • Changelog
  • Console Guide
    • New Console Introduction
    • Creating and Upgrading an Application
    • Basic Configuration
    • Feature Configuration
    • Account Management
    • Group Management
    • Webhook Configuration
    • Usage Statistics
    • Real-Time Monitor
    • Auxiliary Development Tools
  • Product Features
    • Message Management
      • One-to-One Message
      • Message Storage
      • Offline Push
      • Group Message
      • Message Formats
    • Account System
      • Login Authentication
      • Online Status Management
    • Group Related
      • Group System
      • Group Management
    • User Profile and Relationship Chain
      • Profile Management
      • Relationship Chain Management
  • Scenario-based Practice
    • AI Chatbot
    • Super Large Entertainment and Collaboration Community
    • Discord Implementation Guide
  • Push Service
    • Overview
    • Activate the Service
    • Quick Start
    • Manufacturer Channel
      • Manufacturer Configuration
        • Android
        • iOS
        • Flutter
        • React-Native
      • Quick Integration
        • Android
        • iOS
        • Flutter
        • React-Native
    • Statistics
    • Troubleshooting Tool
    • Client APIs
      • Android
      • iOS
      • Flutter
      • React Native
    • REST API
      • Pushing to All/Tagged Users
      • UserID-Targeted Push
      • Obtaining Application Attribute Names
      • Setting Application Attribute Names
      • Obtaining User Attributes
      • Setting User Attributes
      • Deleting User Attributes
      • Obtaining User Tags
      • Adding User Tags
      • Deleting User Tags
      • Deleting All User Tags
      • Recalling Push
    • Push Callback
      • All Users / Tags / UserID Push Callback
      • Other Push Callbacks
    • Advanced Features
      • Custom Definition Badge
      • Custom Definition Ringtone
      • Customized Icon
      • Custom Definition Click Redirect
      • Push Message Categorization
    • Release Notes
      • Android
      • iOS
      • Flutter
      • React Native
    • FAQS
  • Error Codes

Contact List

This article will guide you in building a contact interface.

Display Effect

If you haven't added any contacts beforehand, the loaded contact interface will be empty. After adding contacts, the contacts will be displayed in the interface list, as shown below:
Contact list is empty
Contact list is not empty



Environment Requirements

Xcode 10 or later
iOS 9.0 or later

Preconditions

Before building the interface, please ensure that you have completed the following 4 things:
1. Created an application in the console.
2. Created some user accounts in the console.
3. Integrated TUIKit or TUIContact.
4. Called the TUILogin login API to log in to the component.
Note:
1. All components use this log in to API. Just log in once every time the application is launched.
2. Please ensure a successful log in to proceed, we recommend performing the following actions in the callback for a successful log in to.
If you haven't completed the above 4 steps, please refer to the corresponding steps in Getting Started first, otherwise you may encounter obstacles when implementing the following features.
If you have already completed them, please continue reading below.

Step Instructions

To display the contacts interface, simply create a TUIContactController object and display it.
Sample code:
Minimalist version
Classic version
#import "TUIContactController_Minimalist.h"

// ContactController is your own ViewController
@implementation ContactController
- (void)viewDidLoad {
// Create TUIContactController_Minimalist
TUIContactController_Minimalist *vc = [[TUIContactController_Minimalist alloc] init];
// Option 1: push vc.
[self.navigationController pushViewController:vc animated:YES];
// Option 2: add vc to your own ViewController.
// [self addChildViewController:vc];
// [self.view addSubview:vc.view];
}
@end
#import "TUIContactController.h"

// ContactController is your own ViewController
@implementation ContactController
- (void)viewDidLoad {
// Create TUIContactController
TUIContactController *vc = [[TUIContactController alloc] init];
// Option 1: push vc.
[self.navigationController pushViewController:vc animated:YES];
// Option 2: add vc to your own ViewController.
// [self addChildViewController:vc];
// [self.view addSubview:vc.view];
}
@end
The features of the contacts interface are divided as shown below:

TUIContact handles click actions in this interface by default, as follows:
Action
Effect
Click on New Contacts
Display pending friend requests
Click on Group Chats
Display all group chats for the currently logged-in account
Click on Blocked List
Display the blocklist for the currently logged-in account
Click on the contact's avatar
Enter the Contact Management interface
Click on the + sign at the top right of the interface
A pop-up menu with Add to Contacts and Add Group
In it, by clicking on the contact's avatar, clicking Add to Contacts, and clicking on Group Chats, you can customize the behavior by implementing the methods in TUIContactControllerListener
Minimalist version
Classic version
@protocol TUIContactControllerListener_Minimalist <NSObject>
@optional
- (void)onSelectFriend:(TUICommonContactCell *)cell;
- (void)onAddNewFriend:(TUICommonTableViewCell *)cell;
- (void)onGroupConversation:(TUICommonTableViewCell *)cell;
@end
@protocol TUIContactControllerListener <NSObject>
@optional
- (void)onSelectFriend:(TUICommonContactCell *)cell;
- (void)onAddNewFriend:(TUICommonTableViewCell *)cell;
- (void)onGroupConversation:(TUICommonTableViewCell *)cell;
@end

More practices

You can locally run the TUIKitDemo source code to explore more interface implementations.

Contact Us

If you have any questions about this article, feel free to join the Telegram Technical Group, where you will receive reliable technical support.
Ask the community!
Start technical discussions and get instant expert support!