{"id":5265,"date":"2014-03-30T20:04:13","date_gmt":"2014-03-30T20:04:13","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/uibuttons-titlelabel-text-is-not-displayed-on-cocoa-touch-collection-of-common-programming-errors\/"},"modified":"2014-03-30T20:04:13","modified_gmt":"2014-03-30T20:04:13","slug":"uibuttons-titlelabel-text-is-not-displayed-on-cocoa-touch-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/uibuttons-titlelabel-text-is-not-displayed-on-cocoa-touch-collection-of-common-programming-errors\/","title":{"rendered":"UIButton&#39;s titleLabel.text is not displayed on Cocoa Touch-Collection of common programming errors"},"content":{"rendered":"<p>After I create a new UIButton at runtime, and set its titleLabel&#8217;s text, the button&#8217;s text is still not displayed.<\/p>\n<p>What am I doing wrong?<\/p>\n<pre><code>-(IBAction) cloneMe: (id) sender{\n\n    if (!currentY) {\n        currentY = [sender frame].origin.y;\n    }\n\n    UIButton *clone = [UIButton buttonWithType:UIButtonTypeRoundedRect];\n    CGRect cloneFrame = [sender frame];\n    cloneFrame.origin.y += currentY + cloneFrame.size.height + 30;\n    clone.frame = cloneFrame;\n    [clone titleLabel].text = @\"I'm a clone\";\n\n    [[sender superview] addSubview:clone];\n\n    currentY = cloneFrame.origin.y + cloneFrame.size.height;\n\n\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>After I create a new UIButton at runtime, and set its titleLabel&#8217;s text, the button&#8217;s text is still not displayed. What am I doing wrong? -(IBAction) cloneMe: (id) sender{ if (!currentY) { currentY = [sender frame].origin.y; } UIButton *clone = [UIButton buttonWithType:UIButtonTypeRoundedRect]; CGRect cloneFrame = [sender frame]; cloneFrame.origin.y += currentY + cloneFrame.size.height + 30; clone.frame [&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-5265","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5265","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=5265"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5265\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}