{"id":178,"date":"2011-08-22T13:42:59","date_gmt":"2011-08-22T20:42:59","guid":{"rendered":"http:\/\/adam.yanalunas.com\/blog\/?p=178"},"modified":"2011-08-22T13:44:46","modified_gmt":"2011-08-22T20:44:46","slug":"emulating-the-native-shadow-on-uimenucontroller","status":"publish","type":"post","link":"http:\/\/adam.yanalunas.com\/blog\/archives\/178","title":{"rendered":"Emulating the native shadow on UIMenuController"},"content":{"rendered":"<p>I&#8217;m an iOS developer! I still love and will continue doing front-end dev for web but I&#8217;m adding another feather to my cap in the way of working on some pretty cool iOS apps. One app I&#8217;ve worked on is <a href=\"http:\/\/itunes.apple.com\/us\/app\/constellation-for-ashford\/id444832035?mt=8\">Constellation<\/a>, an eBook reader developed for <a href=\"http:\/\/ashford.edu\">Ashford Education<\/a>. It&#8217;s pretty cool.<\/p>\n<p>One of the things we do is emulate the UIMenuController with our own more powerful view controller. And one of the neat things about a UIMenuController is that you get a slick, subtle drop shadow wherever it is placed. Being the guy I am I spent some time to analyze the drop shadow in Photoshop and do my best to emulate it. Here&#8217;s what I came up with. Have a better solution? Tell me in the comments!<\/p>\n<pre class=\"brush: objc; title: ; notranslate\" title=\"\">\r\n- (void) viewDidLoad\r\n{\r\n\t[super viewDidLoad];\r\n\t\r\n\tself.view.layer.shadowColor = [[UIColor blackColor] CGColor];\r\n\tself.view.layer.shadowOffset = CGSizeMake(0, 2.0f);\r\n\tself.view.layer.shadowOpacity = .55f;\r\n\tself.view.layer.shadowRadius = 2.0f;\r\n\tself.view.layer.shouldRasterize = YES; \r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m an iOS developer! I still love and will continue doing front-end dev for web but I&#8217;m adding another feather to my cap in the way of working on some pretty cool iOS apps. One app I&#8217;ve worked on is Constellation, an eBook reader developed for Ashford Education. It&#8217;s pretty cool. One of the things [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/posts\/178"}],"collection":[{"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/comments?post=178"}],"version-history":[{"count":6,"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/posts\/178\/revisions"}],"predecessor-version":[{"id":183,"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/posts\/178\/revisions\/183"}],"wp:attachment":[{"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/media?parent=178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/categories?post=178"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/adam.yanalunas.com\/blog\/wp-json\/wp\/v2\/tags?post=178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}