{"id":4506,"date":"2014-03-30T12:40:32","date_gmt":"2014-03-30T12:40:32","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/iterate-through-object-properties-and-change-current-property-in-a-loop-in-objective-c-collection-of-common-programming-errors\/"},"modified":"2014-03-30T12:40:32","modified_gmt":"2014-03-30T12:40:32","slug":"iterate-through-object-properties-and-change-current-property-in-a-loop-in-objective-c-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/iterate-through-object-properties-and-change-current-property-in-a-loop-in-objective-c-collection-of-common-programming-errors\/","title":{"rendered":"iterate through object properties and change current property in a loop in objective-c-Collection of common programming errors"},"content":{"rendered":"<p>Newbie question: Can one substitue commands, properties or methods for NSStrings or char at runtime?<\/p>\n<p>Lets say I do something like this:<\/p>\n<pre><code>\/\/these are the names of my properties of an NSObject I created\nchar theChangingProperty[17][18] = {\"name\", \"title\", \"number\", \"property4\", \"property5\", \"property6\", \"property7\", \"property8\", \"property9\", \"property10\", \"property11\", \"property12\", \"property13\", \"property14\", \"property15\", \"property16\", \"property17\"};\n<\/code><\/pre>\n<p>(PS I know there is a better actual objective-c way of getting an objects properties, I even found a post with this Get an object attributes list in Objective-C)<\/p>\n<p>anyway, how does one iterate through a list and have the property name change? Lets say I&#8217;m using dot notation at runtime during a loop&#8230; If I wanted to set 17 (or 100!) different properties of my object all to values of some other array all at once, like this:<\/p>\n<pre><code>for (int t=1; t<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Newbie question: Can one substitue commands, properties or methods for NSStrings or char at runtime? Lets say I do something like this: \/\/these are the names of my properties of an NSObject I created char theChangingProperty[17][18] = {&#8220;name&#8221;, &#8220;title&#8221;, &#8220;number&#8221;, &#8220;property4&#8221;, &#8220;property5&#8221;, &#8220;property6&#8221;, &#8220;property7&#8221;, &#8220;property8&#8221;, &#8220;property9&#8221;, &#8220;property10&#8221;, &#8220;property11&#8221;, &#8220;property12&#8221;, &#8220;property13&#8221;, &#8220;property14&#8221;, &#8220;property15&#8221;, &#8220;property16&#8221;, &#8220;property17&#8221;}; (PS [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4506","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4506","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4506"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4506\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4506"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4506"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}