{"id":1366,"date":"2017-12-26T21:14:05","date_gmt":"2017-12-26T12:14:05","guid":{"rendered":"http:\/\/blue-bear.jp\/kb\/?p=1366"},"modified":"2017-12-26T21:14:05","modified_gmt":"2017-12-26T12:14:05","slug":"swift4-uiscrollview%e3%81%8cautolayout%e3%81%a7%e9%85%8d%e7%bd%ae%e3%81%99%e3%82%8b%e3%81%a8%e3%82%b9%e3%82%af%e3%83%ad%e3%83%bc%e3%83%ab%e3%81%97%e3%81%aa%e3%81%84%e5%95%8f%e9%a1%8c","status":"publish","type":"post","link":"https:\/\/blue-bear.jp\/kb\/swift4-uiscrollview%e3%81%8cautolayout%e3%81%a7%e9%85%8d%e7%bd%ae%e3%81%99%e3%82%8b%e3%81%a8%e3%82%b9%e3%82%af%e3%83%ad%e3%83%bc%e3%83%ab%e3%81%97%e3%81%aa%e3%81%84%e5%95%8f%e9%a1%8c\/","title":{"rendered":"[swift4] UIScrollView\u304cAutoLayout\u3067\u914d\u7f6e\u3059\u308b\u3068\u30b9\u30af\u30ed\u30fc\u30eb\u3057\u306a\u3044\u554f\u984c"},"content":{"rendered":"<p>\u74b0\u5883\uff1aXcode9 swift4<\/p>\n<p>UIScrollView\u304cAutoLayout\u3067\u914d\u7f6e\u3059\u308b\u3068\u30b9\u30af\u30ed\u30fc\u30eb\u3057\u306a\u3044\u554f\u984c\u306f\u4e0b\u8a18\u306e\u901a\u308a\u3067\u89e3\u6c7a\u3059\u308b\u3002<\/p>\n<pre>\r\n    @IBOutlet var scrollView: UIScrollView!\r\n    @IBOutlet var baseView: UIView!\r\n\r\n override func viewDidLayoutSubviews() {\r\n        super.viewDidLayoutSubviews()\r\n        \r\n        let contentWidth = scrollView.bounds.width\r\n        let contentHeight = baseView.bounds.height*1.5\r\n        scrollView.contentSize = CGSize(width: contentWidth, height: contentHeight)\r\n    }\r\n<\/pre>\n<p>scrollView\u306e\u4e0a\u306bbaseView\u3092\u4e57\u305b\u3066\u3001baseView\u306e\u4e0a\u306b\u5404\u6750\u6599\u3092\u4e57\u305b\u3066\u3044\u308b<\/p>\n<p>\uff0ascrollView\u3068baseView\u306f\u4e0a\u4e0b\u53f3\u5de6\u306eMargin\u30920\u3068\u3044\u3046\u6210\u7d04\u3067AutoLayout\u3057\u3066\u3044\u308b\u3002<\/p>\n<p>viewDidLayoutSubviews\u3067Autolayout\u8981\u7d20\u3092\u4e0a\u66f8\u304d\u3067\u304d\u308b\u3002<\/p>\n<p>scrollView\u304c\u3053\u308c\u3067\u5909\u66f4\u306b\u306a\u3063\u3066\u3082\u3001scrollView\u3092\u53c2\u7167\u3057\u3066Autolayout\u3067\u914d\u7f6e\u3057\u3066\u3044\u308b\u4ed6\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u3044\u3044\u611f\u3058\u306b\u8abf\u6574\u3057\u3066\u304f\u308c\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u74b0\u5883\uff1aXcode9 swift4 UIS<\/p>\n","protected":false},"author":1,"featured_media":88,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/1366"}],"collection":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/comments?post=1366"}],"version-history":[{"count":1,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/1366\/revisions"}],"predecessor-version":[{"id":1367,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/1366\/revisions\/1367"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/media\/88"}],"wp:attachment":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/media?parent=1366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/categories?post=1366"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/tags?post=1366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}