{"id":4292,"date":"2014-03-30T09:43:58","date_gmt":"2014-03-30T09:43:58","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/trouble-with-iboutlet-variable-names-closed-collection-of-common-programming-errors\/"},"modified":"2014-03-30T09:43:58","modified_gmt":"2014-03-30T09:43:58","slug":"trouble-with-iboutlet-variable-names-closed-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/trouble-with-iboutlet-variable-names-closed-collection-of-common-programming-errors\/","title":{"rendered":"Trouble with IBOutlet Variable Names [closed]-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m having trouble casting a string to exchange for an <code>IBOutlet<\/code> variable name in my code.<\/p>\n<p>I&#8217;m trying to reference an instance of an <code>IBOutlet UILabel<\/code> that was declared in the header file by programmatically creating the same variable name later on.<\/p>\n<p>However, when I cast an string to try &amp; substitute for the <code>IBOutlet UILabel<\/code> variable name, the program crashes.<\/p>\n<p>Hopefully, the example below explains what&#8217;s happening &amp; why needed. Sorry if the description is a little shaky &#8211; I&#8217;m a beginner.<\/p>\n<p>When I create <code>UILabel *tempLabelName<\/code> to try &amp; substitute identically for <code>IBOutlet UILabel *property<\/code> (referenced in <code>propertyUseForNaming<\/code> example below) declared in the header file, the program crashes!<\/p>\n<pre><code>for (int i = 0; int &lt; 5; i++)\n{    \n\n    NSString *tempText = [[NSString alloc] initWithFormat:@\"%d\", [aReferenceObject[i] integerToDisplayAsText]];\n\n    UILabel *tempLabelName = [NSString stringWithFormat:@\"%@\", [aReferenceObject[i] propertyUseForNaming]];\n\n    [tempLabelName setText: tempText];\n\n}\n<\/code><\/pre>\n<p>Can someone please help me and explain how I can do this\/offer further advice?<\/p>\n<p>Much appreciated.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m having trouble casting a string to exchange for an IBOutlet variable name in my code. I&#8217;m trying to reference an instance of an IBOutlet UILabel that was declared in the header file by programmatically creating the same variable name later on. However, when I cast an string to try &amp; substitute for the IBOutlet [&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-4292","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4292","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=4292"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4292\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}