在UITableView.h中,在UITableView的接口(interface)声明中,有一个ivar struct _tableFlags。该结构的成员都被定义为 unsigned int,但是每个成员的标题后跟一个冒号,然后是一个数字。
struct {
unsigned int dataSourceNumberOfRowsInSection:1;
unsigned int dataSourceCellForRow:1;
…
unsigned int longPressAutoscrollingActive:1;
unsigned int adjustsRowHeightsForSectionLocation:1;
unsigned int customSectionContentInsetSet:1;
} _tableFlags;
Cocoa 倾向于在其头文件中普遍使用这种语法,但我不知道它的含义和功能是什么。成员(member)名称后面的冒号和数字是什么意思?
最佳答案
这些是位字段。冒号后的数字是变量在结构中占用的位数。
关于ios - UITableView.h中ivar结构_tableFlags的语法是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10973993/