what does -arrayWithArray actually DO?

前端 未结 4 597
执笔经年
执笔经年 2020-12-16 04:27

I want to see EXACTLY how it creates an array. How can I view the .m files that show how it\'s done?

4条回答
  •  醉梦人生
    2020-12-16 04:56

    No, Cocoa is not open source.

    If you have a question, you should just ask it.

    This would be one valid way to implement it:

    + (id)arrayWithArray:(NSArray *)array {
        return [[[self alloc] initWithArray:array] autorelease];
    }
    

    You can read the GNUStep source for NSArray, but be aware that this is an alternate implementation of the Cocoa APIs.

提交回复
热议问题