AutoLayout

所属分类:硬件设计
开发工具:Swift
文件大小:0KB
下载次数:0
上传日期:2018-10-02 11:25:44
上 传 者sh-1993
说明:  iOS 11和Swift 4.0中的自动编程布局,
(Autolayout Programmetically in iOS 11 and Swift 4.0,)

文件列表:
AutoLayoutLearning.xcodeproj/ (0, 2018-10-02)
AutoLayoutLearning.xcodeproj/project.pbxproj (12331, 2018-10-02)
AutoLayoutLearning.xcodeproj/project.xcworkspace/ (0, 2018-10-02)
AutoLayoutLearning.xcodeproj/project.xcworkspace/contents.xcworkspacedata (163, 2018-10-02)
AutoLayoutLearning.xcodeproj/xcuserdata/ (0, 2018-10-02)
AutoLayoutLearning.xcodeproj/xcuserdata/Jethi.xcuserdatad/ (0, 2018-10-02)
AutoLayoutLearning.xcodeproj/xcuserdata/Jethi.xcuserdatad/xcdebugger/ (0, 2018-10-02)
AutoLayoutLearning.xcodeproj/xcuserdata/Jethi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist (91, 2018-10-02)
AutoLayoutLearning.xcodeproj/xcuserdata/Jethi.xcuserdatad/xcschemes/ (0, 2018-10-02)
AutoLayoutLearning.xcodeproj/xcuserdata/Jethi.xcuserdatad/xcschemes/xcschememanagement.plist (341, 2018-10-02)
AutoLayoutLearning/ (0, 2018-10-02)
AutoLayoutLearning/AppDelegate.swift (2202, 2018-10-02)
AutoLayoutLearning/Assets.xcassets/ (0, 2018-10-02)
AutoLayoutLearning/Assets.xcassets/AppIcon.appiconset/ (0, 2018-10-02)
AutoLayoutLearning/Assets.xcassets/AppIcon.appiconset/Contents.json (1590, 2018-10-02)
AutoLayoutLearning/Assets.xcassets/Contents.json (62, 2018-10-02)
AutoLayoutLearning/Base.lproj/ (0, 2018-10-02)
AutoLayoutLearning/Base.lproj/LaunchScreen.storyboard (1681, 2018-10-02)
AutoLayoutLearning/Base.lproj/Main.storyboard (3044, 2018-10-02)
AutoLayoutLearning/Info.plist (1463, 2018-10-02)
AutoLayoutLearning/ViewController.swift (5531, 2018-10-02)
LICENSE (1070, 2018-10-02)

# AutoLayout Autolayout Programmetically in iOS 11 and Swift 4.0 ## Prerequisites Xcode 9.2 and Swift 4 ## Getting Started Auto Layout is a tool from Apple that enables you to create user interfaces that adapt to the different screen sizes of iPhone and iPad devices (and Mac too!). It's like responsive web design, but it provides more control (and dynamic behaviors). Autolayouts completely work upon constraints. Constraints can be set in two different general ways: Graphically and programmatically. Most people prefer the graphical way to set the constraints, working directly in the storyboard or XIB files. The big advantage of that option is that it offers immediate visual contact to the views that constraints should apply to, so you just “see and do”. However, and despite the easiness of this method, it’s highly possible to mess things up by setting contradictory constraints that cannot be satisfied simultaneously at runtime. Most of the times Xcode is quite helpful by indicating the misplaced constraints and providing tips on what’s wrong and problematic with the constraints, so you just proceed by fixing and updating your constraints until there are no more conflicts. Here we are bringing you some simple way to set constraints programmetically using anchors. Basically in both Graphically and Programmatically we use the same concept of alingment and constraints. The view controller’s top and bottom layout guides have topAnchor, bottomAnchor, and heightAnchor properties. Views, on the other hand, expose anchors for their edges, centers, size, and baselines. Apart from this we can constrain horizontal anchors (leadingAnchor or trailingAnchor) only with other horizontal anchors We need to set translatesAutoresizingMaskIntoConstraints properties of the IBOutlets as false to make constraints active through programmetically Useful link to follow programmetical concept of Constraints in iOS is [Programmatically Creating Constraints](https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/ProgrammaticallyCreatingConstraints.html) ## Author Any suggestion and feedback invited: [Facebook](https://www.facebook.com/dsrijan), [Github](https://www.github.com/dsrijan), [Twitter](https://www.twitter.com/asksrijan), [LinkedIn](https://www.linkedin.com/in/srijan12345/) ## License This project is licensed under the MIT License - see the [LICENSE.md](LICENSE) file for details

近期下载者

相关文件


收藏者