NSArray arrayWithObjects: if nil is meant to mark array end, can I do …nil, nil]?

前端 未结 4 2080
梦谈多话
梦谈多话 2021-01-03 07:40

If nil is meant to mark the end of parameters, then can I use:

[NSArray arrayWithObjects:obj1, obj2, nil, nil, nil];

as the first nil marks

4条回答
  •  庸人自扰
    2021-01-03 08:08

    Yes, exactly, this can be done. The nils after the first one will be ignored.

提交回复
热议问题