{"action":"created","issue":{"url":"https://api.github.com/repos/sctravel/willGiveIOS/issues/18","labels_url":"https://api.github.com/repos/sctravel/willGiveIOS/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/sctravel/willGiveIOS/issues/18/comments","events_url":"https://api.github.com/repos/sctravel/willGiveIOS/issues/18/events","html_url":"https://github.com/sctravel/willGiveIOS/issues/18","id":57281521,"number":18,"title":"make AutoLayout work with iPhone and iPad","user":{"login":"cyruszhang","id":2977989,"avatar_url":"https://avatars.githubusercontent.com/u/2977989?v=3","gravatar_id":"","url":"https://api.github.com/users/cyruszhang","html_url":"https://github.com/cyruszhang","followers_url":"https://api.github.com/users/cyruszhang/followers","following_url":"https://api.github.com/users/cyruszhang/following{/other_user}","gists_url":"https://api.github.com/users/cyruszhang/gists{/gist_id}","starred_url":"https://api.github.com/users/cyruszhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyruszhang/subscriptions","organizations_url":"https://api.github.com/users/cyruszhang/orgs","repos_url":"https://api.github.com/users/cyruszhang/repos","events_url":"https://api.github.com/users/cyruszhang/events{/privacy}","received_events_url":"https://api.github.com/users/cyruszhang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-11T06:32:20Z","updated_at":"2015-02-11T06:32:46Z","closed_at":null,"body":"some tutorials on AutoLayout; design app layout for universal purposes; design by intent rather than hardcoding dimensions of individual views\r\nhttp://www.raywenderlich.com/83129/beginning-auto-layout-tutorial-swift-part-1"},"comment":{"url":"https://api.github.com/repos/sctravel/willGiveIOS/issues/comments/73839433","html_url":"https://github.com/sctravel/willGiveIOS/issues/18#issuecomment-73839433","issue_url":"https://api.github.com/repos/sctravel/willGiveIOS/issues/18","id":73839433,"user":{"login":"cyruszhang","id":2977989,"avatar_url":"https://avatars.githubusercontent.com/u/2977989?v=3","gravatar_id":"","url":"https://api.github.com/users/cyruszhang","html_url":"https://github.com/cyruszhang","followers_url":"https://api.github.com/users/cyruszhang/followers","following_url":"https://api.github.com/users/cyruszhang/following{/other_user}","gists_url":"https://api.github.com/users/cyruszhang/gists{/gist_id}","starred_url":"https://api.github.com/users/cyruszhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyruszhang/subscriptions","organizations_url":"https://api.github.com/users/cyruszhang/orgs","repos_url":"https://api.github.com/users/cyruszhang/repos","events_url":"https://api.github.com/users/cyruszhang/events{/privacy}","received_events_url":"https://api.github.com/users/cyruszhang/received_events","type":"User","site_admin":false},"created_at":"2015-02-11T06:32:46Z","updated_at":"2015-02-11T06:32:46Z","body":"Designing by Intent\r\nThe big advantage of using constraints is that you no longer have to fiddle with coordinates to get your views to appear in the proper places. Instead, you can describe to Auto Layout how the views are related to each other and Auto Layout will do all the hard work for you. This is called designing by intent.\r\nWhen you design by intent, you’re expressing what you want to accomplish but not necessarily how it should be accomplished. Instead of saying: “the button’s top-left corner is at coordinates (20, 230)”, you now say:\r\n“The button is centered vertically in its superview, and it is placed at a fixed distance from the left edge of the superview.”\r\nUsing this description, Auto Layout can automatically calculate where your button should appear, no matter how big or small that superview is.\r\nOther examples of designing with intent (and Auto Layout can handle all of these instructions):\r\n“These two text fields should always be the same size.”\r\n“These two buttons should always move together.”\r\n“These four labels should always be right-aligned.”\r\nThis makes the design of your user interfaces much more descriptive. You simply define the constraints, and the system calculates the frames for you automatically.\r\nYou saw in the first section that even a layout with just a few views needs quite a bit of work to layout properly in both orientations. With Auto Layout you can skip all that effort. If you set up your constraints properly, then the layout should work without any changes in both portrait and landscape.\r\nAnother important benefit of using Auto Layout is internationalization. Text in German, for example, is infamous for being very long and getting it to fit into your labels can be a headache. Again, Auto Layout takes all this work out of your hands, because it can automatically resize your labels based on the content they need to display – and have everything else adapt with constraints.\r\nAdding support for German, French, or any other language is now simply a matter of setting up your constraints, translating the text, and… that’s it!"}}