Why “loadNibNamed” methods return array?

后端 未结 3 870
轮回少年
轮回少年 2021-01-21 12:37

When we use the loadNibNamed method to get nib file, why will return a array, is not a nib file name corresponds to a nib file? I try to print this array\'s count, I found it al

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-21 13:36

    The reason that xib return an array is that ".XIB" can contain multiple views. The advantage is that you don't have to create one xib file for one view. You simply just put multiple views into one XIB and access it from an array

    Example
    .Xib --> array[view1, view2, view3, view4]

    You can see from image

提交回复
热议问题