Showing
1 changed file
with
36 additions
and
3 deletions
@@ -201,6 +201,39 @@ make.center.equalTo(button1) | @@ -201,6 +201,39 @@ make.center.equalTo(button1) | ||
201 | // make centerX = superview.centerX - 5, centerY = superview.centerY + 10 | 201 | // make centerX = superview.centerX - 5, centerY = superview.centerY + 10 |
202 | make.center.equalTo(superview).centerOffset(CGPointMake(-5, 10)) | 202 | make.center.equalTo(superview).centerOffset(CGPointMake(-5, 10)) |
203 | ``` | 203 | ``` |
204 | +## When the ^&*!@ hits the fan! | ||
205 | + | ||
206 | +Laying out your views doesn't always goto plan. So when things literally go pear shaped, you don't want to be looking at console output like this: | ||
207 | + | ||
208 | +``` | ||
209 | +Unable to simultaneously satisfy constraints.....blah blah blah.... | ||
210 | +( | ||
211 | + "<MASLayoutConstraint:0x7189ac0 V:[UILabel:0x7186980(>=5000)]>", | ||
212 | + "<NSAutoresizingMaskLayoutConstraint:0x839ea20 h=--& v=--& V:[MASExampleDebuggingView:0x7186560(416)]>", | ||
213 | + "<MASLayoutConstraint:0x7189c70 UILabel:0x7186980.bottom == MASExampleDebuggingView:0x7186560.bottom - 10>", | ||
214 | + "<MASLayoutConstraint:0x7189560 V:|-(1)-[UILabel:0x7186980] (Names: '|':MASExampleDebuggingView:0x7186560 )>" | ||
215 | +) | ||
216 | + | ||
217 | +Will attempt to recover by breaking constraint | ||
218 | +<MASLayoutConstraint:0x7189ac0 V:[UILabel:0x7186980(>=5000)]> | ||
219 | +``` | ||
220 | + | ||
221 | +Masonry adds a category to NSLayoutConstraint which overrides the default implementation of `- (NSString *)description` it allows you to give meaningful names to views and constraints which means your console output can now look like this: | ||
222 | + | ||
223 | +``` | ||
224 | +Unable to simultaneously satisfy constraints......blah blah blah.... | ||
225 | +( | ||
226 | + "<NSAutoresizingMaskLayoutConstraint:0x8887740 MASExampleDebuggingView:superview.height == 416>", | ||
227 | + "<MASLayoutConstraint:ConstantConstraint UILabel:view3.height >= 5000>", | ||
228 | + "<MASLayoutConstraint:BottomConstraint UILabel:view3.bottom == MASExampleDebuggingView:superview.bottom - 10>", | ||
229 | + "<MASLayoutConstraint:ConflictingConstraint[0] UILabel:view3.top == MASExampleDebuggingView:superview.top + 1>" | ||
230 | +) | ||
231 | + | ||
232 | +Will attempt to recover by breaking constraint | ||
233 | +<MASLayoutConstraint:ConstantConstraint UILabel:view3.height >= 5000> | ||
234 | +``` | ||
235 | + | ||
236 | +For an example of how to set this up take a look at the **MasonryExamples** project in the Masonry workspace. | ||
204 | 237 | ||
205 | ## Installation | 238 | ## Installation |
206 | Use the [orsome](http://www.youtube.com/watch?v=YaIZF8uUTtk) [CocoaPods](http://github.com/CocoaPods/CocoaPods). | 239 | Use the [orsome](http://www.youtube.com/watch?v=YaIZF8uUTtk) [CocoaPods](http://github.com/CocoaPods/CocoaPods). |
@@ -218,11 +251,11 @@ Get busy Masoning | @@ -218,11 +251,11 @@ Get busy Masoning | ||
218 | ``` | 251 | ``` |
219 | 252 | ||
220 | ## Features | 253 | ## Features |
221 | -* No macro magic. Masonry won't pollute the global namespace with macros. | 254 | +* Orsome debug support, give your views and constraints meaningful names. |
255 | +* Constraints read like sentences. | ||
256 | +* No crazy macro magic. Masonry won't pollute the global namespace with macros. | ||
222 | * Not string or dictionary based and hence you get compile time checking. | 257 | * Not string or dictionary based and hence you get compile time checking. |
223 | 258 | ||
224 | ## TODO | 259 | ## TODO |
225 | * Eye candy | 260 | * Eye candy |
226 | -* Better debugging help for complicated layouts | ||
227 | -* Header comments/Documentation | ||
228 | * More tests and examples | 261 | * More tests and examples |
-
Please register or login to post a comment