What does the ivar _tableFlags structure syntax in UITableView.h mean?

In UITableView.h, in the interface declaration for UITableView, ivar struct _tableFlags exists. All members of the structure are defined as unsigned int, but each member is followed by a colon followed by a number.

struct {
    unsigned int dataSourceNumberOfRowsInSection:1;
    unsigned int dataSourceCellForRow:1;

...

    unsigned int longPressAutoscrollingActive:1;
    unsigned int adjustsRowHeightsForSectionLocation:1;
    unsigned int customSectionContentInsetSet:1;
} _tableFlags;

Cocoa tends to make wide use of this syntax in its header files, but I don't know what that means and what its function is. What does the colon and the number following the participant’s title mean?

+5
source share
1 answer

These are bit fields. The number after the colon is the number of bits that the variable takes in the structure.

See also: how to declare an unsigned int in a C program

+5
source

All Articles