what does -arrayWithArray actually DO?(-arrayWithArray 实际上是做什么的?)
本文介绍了-arrayWithArray 实际上是做什么的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想看看它是如何创建一个数组的.如何查看显示其完成方式的 .m 文件?
I want to see EXACTLY how it creates an array. How can I view the .m files that show how it's done?
推荐答案
正如@Ken 提到的,你看不到源代码(虽然你可以通过gdb 反汇编方法).
As @Ken mentioned, you can't see the source (although you can disassemble the method via gdb).
该方法本身会创建给定数组的不可变(无法更改)、自动释放副本.以下行为相同:
The method itself creates an immutable (can't be changed), autoreleased copy of the given array. The following are identical in behavior:
// Both resulting arrays are immutable and won't be retained
NSArray* immutableArray = [[[NSArray alloc] initWithArray:mutableArray] autorelease];
NSArray* immutableArray = [NSArray arrayWithArray:mutableArray];
NSArray* immutableArray = [[mutableArray copy] autorelease];
我猜,请根据简洁性来选择你喜欢的那个:-).
Pick whichever one you like based on brevity, I guess :-).
这篇关于-arrayWithArray 实际上是做什么的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
织梦狗教程
本文标题为:-arrayWithArray 实际上是做什么的?
基础教程推荐
猜你喜欢
- 如何从 logcat 中删除旧数据? 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
