Xcode 9和iOS 11的14種自動布局最佳做法(使用情節提要)



使用「自動布局」為任何尺寸的iPhone設計iPhone應用程序。使用這14項自動版式最佳實踐可以節省時間和挫敗感。

閱讀所有30種自動布局最佳做法:http://blog.supereasyapps.com/30-auto-layout-best-practices/

自動布局可能很難理解,因為當您將其與編寫一行Swift代碼進行比較時,反饋循環會延遲。為了有效地使用它,您需要了解可以節省時間並避免常見麻煩的策略。

了解以下所有30種最佳做法:

1. iPhone 8的設計
2.設置一台iPhone的用戶界面
3.撤消和重做
4.相對和居中布局
5.確定結構區域
6.了解顏色
7.單向工作
8.隧道盡頭的光
9.隱藏的布局錯誤面板
10.更改背景顏色
11.對角線阻力
12. Shift鍵修改器
13.添加困難約束
14.修復UIImageView內容模式
15.何時使用堆棧視圖
16.設計可調整大小和可伸縮的圖像
17.通過圖像切片正確拉伸
18.創建自定義@IBDesignable UIViews
19.高級圖像調整大小
20.使用Swift 4代碼調整大小的UIImage
21.高級約束編輯器
22.測試不同的iPhone尺寸等級
23.解決約束衝突
24.一種觀點
25.幀與約束常量
26.快速遍歷副本
27.備份自動布局
28.清除約束並重新啟動
29.對齊和打領帶按鈕
30.不要使用這些設置

免費的iPhone Apps課程:http://SuperEasyApps.com

閱讀所有30種自動布局最佳做法:http://blog.supereasyapps.com/30-auto-layout-best-practices/

14 Xcode 9和iOS 11的自動版式最佳做法(使用情節提要)。

33 comments
  1. Hi Paual,

    Really nice and easy to understand video, Thanks for putting this up.. it was really helpful.
    At the start of the video you mentioned the tool (Sketch if i got it right) you use to create mock up screens. Appreciate if you can share some more info on that tool as about whether its available in Appstore or need to download it from website.

    Once again Thanks for superb tutorial.. Cheers…!!

  2. I am stuck with design ui in ios development. When I run up the application with big as such iphone 6, 6s, 7…are good and problem with smaller devices like 5, 5s..problem with ui anyone pls help me on this?

  3. I thought I had found the best tutorial for Auto Layout but I wish you had done it better. You never explained the difference between 'Trailing' and 'Leading'. You just did it so fast without proper explanation. You did not do the Horizontal Layout. I really really wish that you had done better on this video. I hope you redo a better and complete Auto Layout tutorial. Fairly Disappointed.

  4. I usually have complex layouts in my apps and it's such a pain in the ass to do the constraints for IOS. I spent 80% of my time trying and testing the output and 20% on codes for iOS app and the reverse for Android apps which means I complete my project quicker in Android.
    Really wish Apple could come up with a better layout solution it's just not productive..

  5. I do have existing objective c project which contains meters but i am Not enable to adjust auto layout constraints for that one can u please help me on auto layout

  6. Well, first, let me just say I really appreciate you making this and going through your full process.

    I'm trying to gauge if constraints are worth using, as someone that generally would script things but will readily use visual tools instead if they are up to snuff.

    I've been trying to get to grips with xcode's constraints for a couple of hours. Its been confusing.

    It appeared professional – until I tried to understand how any one thing is constrained to its neighbors, and to the page as a whole. That info is there… but its not quickly interpretable, instead being an unordered list of constraints. After some other surprises (duplicate constraints, xcode bugs, some things combined that shouldn't be), well, that's when I looked and found your video.

    Then hearing you have 30 best practices – I'd expected a dozen, but this sounds like a minefield of poorly communicated design decisions by apple (among other issues).

    Still, I'll hold off on that opinion till I've at least finished watching your video. I want to see what the workflow could be like at best.

  7. Thanks Paul. Here's a few tips for your viewers, from the School of been-there-done-that:

    Before you open up Xcode, make sure your design is workable on a REAL device. Designing a UI on a large screen and using it in the Simulator with a mouse can create a distorted impression of how usable your design really is. You will likely find that your "pixel-perfect" Sketch design is too small/fiddly to use with real fingers on a real phone or pad.

    So, as part of your design iteration loop, export your Sketch screens as PNGs. View them on your actual iDevice. Adjust your design — and any preconceived notions — until the design is workable. This is far less expensive than having to change your design later.

    Also, I advise designing for the smallest screens (I design for the iPhone 5S). If you design for a larger phone first, your design may be entirely unworkable on smaller screens: and there are millions of people still using those phones. (And that's when devs start saying things like "well, I'll only support iPhone X or later"). It's far easier to scale your design up in size, than reduce it later.

    Also, remember the software keyboard. The appearance of the keyboard can have a huge impact on your UI and workload, so factor it in from day one. And remember too that the software keyboard may not appear if someone is using a bluetooth keyboard, but you still have to provide a UI to accommodate the text entry…

    Cheers, and good luck with your design.

  8. Hi. For beginners, it would be useful to say that this Views would be nice to place in the Scroll View, since when the keyboard appears, it will not be enough simply to lift the entire structure upward so that it does not overlap the input fields. Sorry for my English 🙂

Comments are closed.