mutableCopyWithZone,复制NSMutableArray?(mutableCopyWithZone, copy NSMutableArray?)
我试图做一个包含5个实例变量的行星对象的mutableCopy(其中之一是一个字符串文字的NSMutableArray。我的问题是,我不确定如何将newPlanet>数据设置为self> data的副本,有道理?
-(id) mutableCopyWithZone: (NSZone *) zone { Planet *newPlanet = [[Planet allocWithZone:zone] init]; NSLog(@"_mutableCopy: %@", [newPlanet self]); [newPlanet setName:name]; [newPlanet setType:type]; [newPlanet setMass:mass]; [newPlanet setIndex:index]; // NSMutableArray *data; HOW TO: newPlanet>data = self>data? return(newPlanet); }
EDIT_001:
基于Chuck&bbum的评论,我更新了我的方法并添加了以下内容......
@property(retain) NSMutableArray *data; @synthesize data;
。
-(id) mutableCopyWithZone: (NSZone *) zone { Planet *newPlanet = [[Planet allocWithZone:zone] init]; NSLog(@"_mutableCopy: %@", [newPlanet self]); [newPlanet setName:name]; [newPlanet setType:type]; [newPlanet setMass:mass]; [newPlanet setIndex:index]; NSMutableArray *copiedArray = [[self data] mutableCopyWithZone:zone]; [newPlanet setData: copiedArray]; [copiedArray release]; return(newPlanet); }
非常感激
加里
I a trying to make a mutableCopy of a planet object that contains 5 instance variables (one of them being an NSMutableArray of string literals. My problem is that I am unsure how to set the newPlanet>data to a copy of self>data, does that make sense?
-(id) mutableCopyWithZone: (NSZone *) zone { Planet *newPlanet = [[Planet allocWithZone:zone] init]; NSLog(@"_mutableCopy: %@", [newPlanet self]); [newPlanet setName:name]; [newPlanet setType:type]; [newPlanet setMass:mass]; [newPlanet setIndex:index]; // NSMutableArray *data; HOW TO: newPlanet>data = self>data? return(newPlanet); }
EDIT_001:
Based on the comments by Chuck & bbum I updated my method and added the following ...
@property(retain) NSMutableArray *data; @synthesize data;
.
-(id) mutableCopyWithZone: (NSZone *) zone { Planet *newPlanet = [[Planet allocWithZone:zone] init]; NSLog(@"_mutableCopy: %@", [newPlanet self]); [newPlanet setName:name]; [newPlanet setType:type]; [newPlanet setMass:mass]; [newPlanet setIndex:index]; NSMutableArray *copiedArray = [[self data] mutableCopyWithZone:zone]; [newPlanet setData: copiedArray]; [copiedArray release]; return(newPlanet); }
much appreciated
gary
原文:https://stackoverflow.com/questions/2015943
满意答案
该消息意味着,在管道内的复制活动中,使用typeProperties(源和接收器的对等体)中的executionLocation属性来指定区域,如“executionLocation”:“East US”。 请参阅此处的文档: https : //docs.microsoft.com/en-us/azure/data-factory/data-factory-data-movement-activities#a-nameglobalaglobally-available-data-movement
The message means, in the copy activity within the pipeline, use the executionLocation property within typeProperties (peer of source and sink) to specify the region, like "executionLocation": "East US". See docs here: https://docs.microsoft.com/en-us/azure/data-factory/data-factory-data-movement-activities#a-nameglobalaglobally-available-data-movement
相关问答
更多无法检测数据源位置。(Can't detect data source location. Please specify ExecutionLocation in CopyActivity)
摆脱“当前位置没有可用的源代码”。(Getting rid of “There is no source code available for the current location.”)
SAP BusinessObjects Crystal Reports - 数据源来自哪里?(SAP BusinessObjects Crystal Reports — Where does the data source come from?)
如何检查Crystal Reports中的数据源是否为空(How to check if data source is empty in Crystal Reports)
如何使用相同的数据源发布多个Lightswitch HTML项目(How to publish multiple Lightswitch HTML projects using the same data source)
无法在SQL中创建外部数据源(Can't CREATE EXTERNAL DATA SOURCE in SQL)
如何关闭Visual Studio的“当前位置没有可用的源代码。”?(How to shut up Visual Studio's “There is no source code available for the current location.”?)
如何本地化数据源的路径?(How to localize path to data source?)
dygraph 1.1.1似乎错误地检测到数据源的范围值(dygraph 1.1.1 appears to incorrectly detect range value for data source)
如何在Spotfire中找到保存数据源的位置?(How to find the location where data source has been saved in Spotfire?)
相关文章
更多rails怎么实现,图片在编辑器里复制就自动上传?
转:Solr 基于java的复制(Master-Slave配置)
数据复制问题
我在福昕阅读器上面复制的东西粘贴到editplus中变成了乱码
Solr4:索引的复制
[Hadoop]使用DistributedCache进行复制联结
cmd进入后的doc窗口的内容如何复制????
原创:用VBA实现将鼠标选择的单元格按照指定格式合并并复制到剪切板
Java-based 实现的索引复制
最新问答
更多获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
如何通过引用返回对象?(How is returning an object by reference possible?)
矩阵如何存储在内存中?(How are matrices stored in memory?)
每个请求的Java新会话?(Java New Session For Each Request?)
css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
xcode语法颜色编码解释?(xcode syntax color coding explained?)
在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!