{"id":4349,"date":"2014-03-30T09:58:53","date_gmt":"2014-03-30T09:58:53","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-to-create-iboutlet-only-for-ipad-in-a-common-uiviewcontroller-universal-app-collection-of-common-programming-errors\/"},"modified":"2014-03-30T09:58:53","modified_gmt":"2014-03-30T09:58:53","slug":"how-to-create-iboutlet-only-for-ipad-in-a-common-uiviewcontroller-universal-app-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-to-create-iboutlet-only-for-ipad-in-a-common-uiviewcontroller-universal-app-collection-of-common-programming-errors\/","title":{"rendered":"How to create IBOutlet only for iPAD in a common UIViewController &#8211; Universal App-Collection of common programming errors"},"content":{"rendered":"<p>I have 2 xibs, one for iPad and one for iPhone. However, currently I have only one view controller for those 2 xibs that works for both iPhone&amp;iPad.<\/p>\n<p>Inside my iPad Xib I have an IBOutlet that doesn&#8217;t belong to the iPhone xib. How should I define that outlet ? I notice that if I put inside my deallc method, something like this :<\/p>\n<pre><code>-(void) dealloc\n{\n    [outletOnlyForIpad release]\n}\n<\/code><\/pre>\n<p>The app crashes on the iPhone. Apparently cause it doesn&#8217;t instantiates well on the iPhone. (I hoped it would stay nil, but it&#8217;s not the case)<\/p>\n<p>I didn&#8217;t find any preprocessor macro that I can use so I can declare that Outlet only for iPad. Is the only way to do it is by checking in runTime something like :<\/p>\n<pre><code>isIpad()\n[outletOnlyForIpad SomeMethodOnTheOutlet]\n<\/code><\/pre>\n<p>In every place in my controller ?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have 2 xibs, one for iPad and one for iPhone. However, currently I have only one view controller for those 2 xibs that works for both iPhone&amp;iPad. Inside my iPad Xib I have an IBOutlet that doesn&#8217;t belong to the iPhone xib. How should I define that outlet ? I notice that if I [&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-4349","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4349","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=4349"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4349\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4349"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}