Is it correct to use short syntax when initializing NSMutableArray?

前端 未结 3 1575
醉梦人生
醉梦人生 2021-01-21 08:58

Usually when we want to initialize NSMutableArray we use:

NSMutableArray *mArr = [[NSMutableArray alloc] initWithObjects: @\"one\", @\"two\", @\"thr         


        
3条回答
  •  深忆病人
    2021-01-21 09:32

    Yes, it's ok to initialize your mutable array that way, if you are willing (as you indicated) to pay the performance cost. ARC will clean everything up appropriately. It won't leak.

提交回复
热议问题