Current location - Health Preservation Learning Network - Slimming men and women - IOS UITableView alphabetical index-the system comes with a search bar.
IOS UITableView alphabetical index-the system comes with a search bar.
The alphabetical index (UItableViewIndex) is a control used in TableView, which inherits from UIControl, but it is not an open class.

Its main function is: when a tableView with more categories has more contents, it provides a quick index function, which can be quickly indexed by clicking and sliding, and adds vibration feedback effect in iOS 10 and later versions.

The system only provides the above methods for us to use, but in many scenarios, these methods are not enough for us. Therefore, we have two ways to deal with special situations: 1, rewrite the indexed view and customize UITableViewIndex;; 2. Set it through the internal property of UITableViewIndex.

Customize UITableViewIndex. We will discuss it in the next section. Let's look at the second method first: set it through the internal property of UITableViewIndex.

Internal properties of 1 and UITableViewIndex

The internal properties of UITableViewIndex are limited. If you simply set the font and color, you can set it through the internal properties of UITableViewIndex, which is simple and convenient.

Ps: For example, modify the font size of index text.