{"id":24969413,"url":"https://github.com/intrepidpursuits/autolayoutdemo","last_synced_at":"2025-03-29T04:47:53.600Z","repository":{"id":151543722,"uuid":"59712632","full_name":"IntrepidPursuits/AutoLayoutDemo","owner":"IntrepidPursuits","description":"AutoLayoutDemo by Intrepid-Pursuits","archived":false,"fork":false,"pushed_at":"2018-09-18T14:49:45.000Z","size":847,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-02-03T14:46:19.818Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IntrepidPursuits.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-26T02:17:40.000Z","updated_at":"2018-09-18T14:37:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"3efaf066-2faa-463b-b2a4-235de284dac1","html_url":"https://github.com/IntrepidPursuits/AutoLayoutDemo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntrepidPursuits%2FAutoLayoutDemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntrepidPursuits%2FAutoLayoutDemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntrepidPursuits%2FAutoLayoutDemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntrepidPursuits%2FAutoLayoutDemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IntrepidPursuits","download_url":"https://codeload.github.com/IntrepidPursuits/AutoLayoutDemo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246140550,"owners_count":20729798,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-03T14:37:57.050Z","updated_at":"2025-03-29T04:47:53.595Z","avatar_url":"https://github.com/IntrepidPursuits.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AutoLayoutDemo\nThese cases are a little contrived as you could use a UIStackView to accomplish these. But it is simple so we can talk about wiring up constraints.\n\n## Basic Horizontal Menu items\n**Story:** \"I want the middle view to be equal size with the others but no wider than 200 points, and the side views should be pinned to each side.\"\n- Layout with IB first\n- Then try adding constraints using code.\n\n\u003cimg src=\"./images/rectangles-portrait.png\" width=\"225\"\u003e\n\n\u003cimg src=\"./images/rectangles-landscape.png\" height=\"225\"\u003e\n\n## Prompt Buttons\n**Story:** \"For _Donation By Text_ button, if there is no more space, have the text expand into multiple lines if needed.\" Then have the cancel button shrink up until the text.\n- Layout with IB using hugging/compression\n\n\u003cimg src=\"./images/prompt-done.png\" width=\"225\"\u003e \u003cimg src=\"./images/prompt-done-expanded.png\" width=\"225\"\u003e\n\n## TableViewCells\nAs of iOS9, UITableViewCells can size themselves based on constraints.\n\n**Story:** \"Show all the _mainText_ in the cells, expanding them and contracting when necessary, but always show the image at 100 x 100.\"\n- Layout with IB\n  - Use margins when needed (be sure to check iPhone X landscape views).\n  - Use inequalities when needed.\n  - Try aligning edges.\n\n\u003cimg src=\"./images/tableview-done.png\" width=\"225\"\u003e\n\n## Layout Anchors\n\n**Story:** \"Show all the _Squares_ in the view, with the following sizes and margins\"\n\n- Top Left:\n    - Height \u0026 width: 100\n    - left margin: 8\n- Top Right:\n    - Height \u0026 width: 40\n    - top margin: 10\n- Bottom Left:\n    - Height \u0026 width: 70\n    - bottom margin: 30\n- Bottom Right:\n    - Height \u0026 width: 23\n    - right margin: 10\n\n- Layout with programmatic layout anchors\n- Use margins when needed (be sure to check iPhone X portrait views).\n\n\u003cimg src=\"./images/layout-anchors-done.png\" width=\"225\"\u003e\n\n## Answers\nYou can use these code samples as a guide or reference if needed:\n\n1. [answer/basic-case-ib](https://github.com/IntrepidPursuits/AutoLayoutDemo/tree/answer/basic-case-ib)\n2. [answer/basic-case-programmatic](https://github.com/IntrepidPursuits/AutoLayoutDemo/tree/answer/basic-case-programmatic)\n3. [answer/basic-case-inequality](https://github.com/IntrepidPursuits/AutoLayoutDemo/tree/answer/basic-case-inequality)\n4. [answer/prompt-hugging-compression](https://github.com/IntrepidPursuits/AutoLayoutDemo/tree/answer/prompt-hugging-compression)\n5. [answer/prompt-multiple-lines](https://github.com/IntrepidPursuits/AutoLayoutDemo/tree/answer/prompt-multiple-lines)\n6. [answer/tableviewcell-layout](https://github.com/IntrepidPursuits/AutoLayoutDemo/tree/answer/tableviewcell-layout)\n7. [answer/layout-anchors-programmatic](https://github.com/IntrepidPursuits/AutoLayoutDemo/tree/answer/layout-anchors-programmatic)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintrepidpursuits%2Fautolayoutdemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintrepidpursuits%2Fautolayoutdemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintrepidpursuits%2Fautolayoutdemo/lists"}