Skip to content

Commit 3a01b88

Browse files
author
Baris Sencan
committed
Update README.md
1 parent da77799 commit 3a01b88

File tree

1 file changed

+1
-57
lines changed

1 file changed

+1
-57
lines changed

README.md

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -30,64 +30,8 @@ This isn't recommended, but you can also put all the code files inside the direc
3030

3131
#Usage
3232

33-
Just `import ManualLayout` in your code and use the methods and properties provided by the library to layout your views.
33+
Just `import ManualLayout` in your code and use the methods and properties provided by the library to layout your views. You can check out the cheat sheet below for a compact list of everything. There are also [example projects](https://github.com/isair/ManualLayout/tree/master/Examples) to get you started.
3434

35-
###A Simple Example
36-
37-
Here is the complete code for a basic view controller.
38-
39-
```swift
40-
import Foundation
41-
import ManualLayout
42-
43-
internal final class ExampleViewController: UIViewController {
44-
let titleLabel = UILabel(frame: CGRectZero)
45-
let subtitleLabel = UILabel(frame: CGRectZero)
46-
let yinView = UIView(frame: CGRectZero)
47-
48-
override init() {
49-
super.init(nibName: nil, bundle: nil)
50-
titleLabel.attributedText = NSAttributedString(
51-
string: "Hello World!",
52-
attributes: generateTextStyle())
53-
subtitleLabel.attributedText = NSAttributedString(
54-
string: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
55-
attributes: generateTextStyle(smaller: true)
56-
yinView.backgroundColor = UIColor.blackColor()
57-
}
58-
59-
required override init(coder aDecoder: NSCoder) {
60-
fatalError("storyboards are incompatible with truth and beauty")
61-
}
62-
63-
override func viewDidLoad() {
64-
super.viewDidLoad()
65-
view.backgroundColor = UIColor.whiteColor()
66-
view.addSubview(titleLabel)
67-
view.addSubview(subtitleLabel)
68-
view.addSubview(yinView)
69-
}
70-
71-
override func viewWillLayoutSubviews() {
72-
titleLabel.sizeToFit()
73-
titleLabel.top = 20
74-
titleLabel.centerX = view.centerX
75-
subtitleLabel.sizeToFit()
76-
subtitleLabel.top = titleLabel.bottom + 8
77-
subtitleLabel.centerX = view.centerX
78-
yinView.top = view.height / 2
79-
yinView.right2 = view.width
80-
yinView.bottom2 = view.height
81-
}
82-
83-
private func generateTextStyle(smaller: Bool = false) -> [NSObject: AnyObject] {
84-
return [
85-
NSFontAttributeName: UIFont.systemFontOfSize(smaller ? 14 : 16),
86-
NSForegroundColorAttributeName: UIColor.blackColor()
87-
]
88-
}
89-
}
90-
```
9135

9236
#API Cheat Sheet
9337

0 commit comments

Comments
 (0)