{"id":1613,"date":"2017-07-26T20:03:40","date_gmt":"2017-07-26T11:03:40","guid":{"rendered":"http:\/\/www.chihayafuru.jp\/tech\/?p=1613"},"modified":"2017-07-27T12:41:28","modified_gmt":"2017-07-27T03:41:28","slug":"autolayout%e3%81%ab%e3%81%8a%e3%81%84%e3%81%a6uinavigationbar%e3%81%ae%e9%87%8d%e3%81%aa%e3%82%8a%e3%82%92%e9%81%bf%e3%81%91%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/archives\/1613","title":{"rendered":"autolayout\u306b\u304a\u3044\u3066UINavigationBar\u306e\u91cd\u306a\u308a\u3092\u907f\u3051\u308b"},"content":{"rendered":"<p>UIViewController\u306etopLayoutGuide\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u53c2\u7167\u3059\u308b\u3002<\/p>\n<pre class=\"lang:objc decode:true \" >self.upperView.translatesAutoresizingMaskIntoConstraints = NO;\r\nself.lowerView.translatesAutoresizingMaskIntoConstraints = NO;\r\n\r\nNSNumber *vPadding = @0;\r\nNSNumber *hPadding = @0;\r\n\r\nid topGuide = self.topLayoutGuide;\r\n    \r\nUIView *upperView = self.upperView;\r\nUIView *lowerView = self.lowerView;\r\n\r\nNSDictionary *views = NSDictionaryOfVariableBindings(topGuide, upperView, lowerView);\r\nNSDictionary *metricsDictionary = NSDictionaryOfVariableBindings(vPadding, hPadding);\r\n\r\nNSArray *vConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@\"V:|-[vPadding]-[topGuide]-[upperView(100)]-[lowerView]-[vPadding]-|\"\r\n                                                                    options:0\r\n                                                                    metrics:metricsDictionary\r\n                                                                      views:views];\r\n[self.view addConstraints:vConstraints];\r\n\r\nNSArray *hConstraints1 = [NSLayoutConstraint constraintsWithVisualFormat:@\"H:|-[hPadding[-[upperView]-[hPadding]-|\"\r\n                                                                    options:0\r\n                                                                    metrics:metricsDictionary\r\n                                                                      views:views];\r\n[self.view addConstraints:hConstraints1];\r\n\r\nNSArray *hConstraints2 = [NSLayoutConstraint constraintsWithVisualFormat:@\"H:|-[hPadding[-[lowerView]-[hPadding]-|\"\r\n                                                                    options:0\r\n                                                                    metrics:metricsDictionary\r\n                                                                      views:views];\r\n[self.view addConstraints:hConstraints2];\r\n\r\n[self.view layoutIfNeeded];<\/pre>\n<hr>\n<p><a href=\"https:\/\/developer.apple.com\/library\/content\/documentation\/UserExperience\/Conceptual\/AutolayoutPG\/\">https:\/\/developer.apple.com\/library\/content\/documentation\/UserExperience\/Conceptual\/AutolayoutPG\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>UIViewController\u306etopLayoutGuide\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u53c2\u7167\u3059\u308b\u3002 self.upperView.translatesAutoresizingMaskIntoConstraints = NO; self [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[7],"class_list":["post-1613","post","type-post","status-publish","format-standard","hentry","category-memo","tag-ios"],"_links":{"self":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/1613","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/comments?post=1613"}],"version-history":[{"count":7,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/1613\/revisions"}],"predecessor-version":[{"id":1620,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/1613\/revisions\/1620"}],"wp:attachment":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/media?parent=1613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/categories?post=1613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/tags?post=1613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}