让NSMutableArray属性填充枚举值(getting NSMutableArray Property filled with enumerated values)
尝试通过使用枚举值填充的NSMutableArray属性中的索引获取枚举值。
我想要的只是设置一个动态属性并在类实例中进行设置。
因此,我编写了一个揭示问题的明确例子。
问题是这个。 示例中的WriteByType方法永远不会获得正确的值。 它应该记录“你得到右箭头”,但事实并非如此
//---------------------------------------------------------- // CCMyClass.h #import <Foundation/Foundation.h> typedef enum { aLeft, aRight } Arrow; @interface CCMyClass : NSObject { NSMutableArray *_arrowsPkg; } @property(nonatomic,copy) NSMutableArray *arrowsPkg; @property (nonatomic)int nextPkgIndex; -(void)GetItemOne; @end //------------------------------------------------------------- // CCMyClass.m #import "CCMyClass.h" @implementation CCMyClass @synthesize arrowsPkg=_arrowsPkg; -(void)WriteByType:(Arrow)AArrow { switch (AArrow) { case aLeft: NSLog(@"You Get Left Arrow"); break; case aRight: NSLog(@"You Get Right Arrow"); break; } } -(void)GetItemOne { Arrow a =(Arrow)[[self arrowsPkg]objectAtIndex:1]; [self WriteByType:a]; } @end //---------------USAGE EXAMPLE---------------------------------------------- // CCAppDelegate.m - (IBAction)btn1Clicked:(id)sender { CCMyClass *c1=[[CCMyClass alloc]init]; NSNumber *v1=[NSNumber numberWithInt:aLeft]; NSNumber *v2=[NSNumber numberWithInt:aRight]; NSMutableArray *arr1=[NSMutableArray arrayWithObjects:v1,v2, nil]; [c1 setArrowsPkg:arr1]; [c1 GetItemOne]; }
Attempting to get an enumerated value by an index from a NSMutableArray property that is filled with enumerated values.
all I wanted is to set a dynamic property and get set back within class instance.
thus, I coded a clear example that expose of problem.
Problem is this. WriteByType method in example never gets correct value. it should log "You Get Right Arrow" but it doesn't
//---------------------------------------------------------- // CCMyClass.h #import <Foundation/Foundation.h> typedef enum { aLeft, aRight } Arrow; @interface CCMyClass : NSObject { NSMutableArray *_arrowsPkg; } @property(nonatomic,copy) NSMutableArray *arrowsPkg; @property (nonatomic)int nextPkgIndex; -(void)GetItemOne; @end //------------------------------------------------------------- // CCMyClass.m #import "CCMyClass.h" @implementation CCMyClass @synthesize arrowsPkg=_arrowsPkg; -(void)WriteByType:(Arrow)AArrow { switch (AArrow) { case aLeft: NSLog(@"You Get Left Arrow"); break; case aRight: NSLog(@"You Get Right Arrow"); break; } } -(void)GetItemOne { Arrow a =(Arrow)[[self arrowsPkg]objectAtIndex:1]; [self WriteByType:a]; } @end //---------------USAGE EXAMPLE---------------------------------------------- // CCAppDelegate.m - (IBAction)btn1Clicked:(id)sender { CCMyClass *c1=[[CCMyClass alloc]init]; NSNumber *v1=[NSNumber numberWithInt:aLeft]; NSNumber *v2=[NSNumber numberWithInt:aRight]; NSMutableArray *arr1=[NSMutableArray arrayWithObjects:v1,v2, nil]; [c1 setArrowsPkg:arr1]; [c1 GetItemOne]; }
原文:https://stackoverflow.com/questions/14667493
最满意答案
我与帮助台聊天,他说你必须手动创建指向你的github帐户的cname记录。
http://davidensinger.com/2013/03/setting-the-dns-for-github-pages-on-namecheap/
I chatted with the helpdesk and he said that you have to create the cname record pointing to your github account manually.
http://davidensinger.com/2013/03/setting-the-dns-for-github-pages-on-namecheap/
相关问答
更多-
https://www.namecheap.com/support/knowledgebase/article.aspx/319/78/how-can-i-setup-an-a-address-record-for-my-domain 这是一个很好的教程,可以帮助您完成旅程 https://www.namecheap.com/support/knowledgebase/article.aspx/319/78/how-can-i-setup-an-a-address-record-for-my-domain ...
-
我的答案可能已经过时了,但希望对某人有用。 在Eclipse中,转到“ 窗口”>“首选项”>“常规”>“网络连接”> “SSH2”(或仅在首选项窗口过滤框中键入“SSH2”)。 (DD)我试图加载一个已知的好的id_rsa密钥,我以前从命令行推我的存储库,并且工作正常。 当尝试在第二步中“添加”键时,我发现两个键的长度不同。 也许这是EGIT和eclipse正在发烧的地方? 我生成的github的密钥是2048,Eclipse / EGit生成的密钥长度是1024。不知道SSH是否足够好,看看是否是这个问题 ...
-
github服务器验证失败(github server verification failed)[2022-11-02]
github今天早些时候遇到了一些问题,因为他们推出了government.github.com。 该网站现在应该正常运作。 github was experiencing some issues earlier today as they launched government.github.com. The site should be functioning normally now. -
我与帮助台聊天,他说你必须手动创建指向你的github帐户的cname记录。 http://davidensinger.com/2013/03/setting-the-dns-for-github-pages-on-namecheap/ I chatted with the helpdesk and he said that you have to create the cname record pointing to your github account manually. http://daviden ...
-
为了支持改进的Github页面,请像这样设置你的记录: HOST NAME IP ADDRESS RECORD TYPE TTL @ 192.30.252.153 A (Address) 1800 www
.github.io CNAME (Alias) 1800 然后,填写SUB-DOMAIN SETTINGS下的一行: HOST NAME IP ADDRESS ... -
事实证明这很简单。 我只需要将存储库声明更改为引用raw.github.com ,如下所示:
com.github.cache4guice https://raw.github.com/dwatrous/cache4guice/mvn-repo true 在这种情况下,它可以是安全连接,端口应该是465 用于SSL的465端口,用于TLS / STARTTLS的25或26端口 It may be secured connection in that case the port should be 465 465 port for SSL, 25 or 26 for TLS/STARTTLS如果要使用子域,还需要在namecheap DNS中将该子域指向弹性IP,然后将apache中的子域绑定到它应该提供文件的网站/位置。 If you want to use a subdomain, you will also need to point that subdomain to the elastic ip as well in your namecheap DNS, and then bind the subdomain in apache to the website/location th ...TXT条目的主机值应该是dkim._domainkey 。 目前您的域密钥位于: dkim._domainkey.linnabary.us.linnabary.us ,因此您不应在此处添加域名。 这就是为什么对测试电子邮件的响应说X-DKIM-Status: invalid (pubkey_unavailable) - 公共密钥无法找到它应该在的位置。 The Host value for your TXT entry should just be dkim._domainkey. Currently yo ...Github失败了(Github failed push)[2021-07-30]
如果更改不是那么大,请考虑在项目之外的其他目录中复制整个文件夹/项目,然后git reset --hard HEAD将清除,删除和删除您最近的更改。 然后,您可以使用save3d副本再次单独应用它们以进行参考。 当然,确保在git commit之前确定git add 。 最后,如果您遇到自动提交合并问题,您可以随时手动编辑文件以解决问题。 If the changes aren't that big, consider making a copy of the entire folder/project i ...相关文章
更多- could not find system property or JNDI
- mybatis There is no getter for property named 'xx' in 'class java.lang.String
- Java枚举学习笔记
- INSERT INTO blog_appitem (user_id,appid,app_secret,is_valid) VALUES (1, 'wxf415741de036114c','48e1e345fd5f11c93af18ff1714c7f78',1)
- 页面获取ACTION的属性,页面不能弹出JS
- solrcore.properties定义server是否是master
- Guava Booleans类-布尔型基本的实用工具类
- jsp中取绝对值 和百分比问题
- 【原】storm源码之巧用java反射反序列化clojure的defrecord获取属性值
- 如何在jsf标签中使用java的枚举类型
最新问答
更多- 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
- Java中的不可变类(Immutable class in Java)
- 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
- linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
- Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
- 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
- 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
- Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
- EXCEL VBA 基础教程下载
- RoR - 邮件中的动态主体(部分)(RoR - Dynamic body (part) in mailer)
- 无法在Google Script中返回2D数组?(Can not return 2D Array in Google Script?)
- JAVA环境变量的设置和对path , classpth ,java_home设置作用和目的?
- mysql 关于分组查询、时间条件查询
- 如何使用PowerShell匹配运算符(How to use the PowerShell match operator)
- Effective C ++,第三版:重载const函数(Effective C++, Third edition: Overloading const function)
- 如何用DELPHI动态建立MYSQL的数据库和表? 请示出源代码。谢谢!
- 带有简单redis应用程序的Node.js抛出“未处理的错误”(Node.js with simple redis application throwing 'unhandled error')
- 使用前端框架带来哪些好处,相对于使用jquery
- Ruby将字符串($ 100.99)转换为float或BigDecimal(Ruby convert string ($100.99) to float or BigDecimal)
- 高考完可以去做些什么?注意什么?
- 如何声明放在main之后的类模板?(How do I declare a class template that is placed after the main?)
- 如何使用XSLT基于兄弟姐妹对元素进行分组(How to group elements based on their siblings using XSLT)
- 在wordpress中的所有页面的标志(Logo in all pages in wordpress)
- R:使用rollapply对列组进行求和的问题(R: Problems using rollapply to sum groups of columns)
- Allauth不会保存其他字段(Allauth will not save additional fields)
- python中使用sys模块中sys.exit()好像不能退出?
- 将Int拆分为3个字节并返回C语言(Splitting an Int to 3 bytes and back in C)
- 在SD / MMC中启用DDR会导致问题吗?(Enabling DDR in SD/MMC causes problems? CMD 11 gives a response but the voltage switch wont complete)
- sed没有按预期工作,从字符串中间删除特殊字符(sed not working as expected, removing special character from middle of string)
- 如何将字符串转换为Elixir中的函数(how to convert a string to a function in Elixir)