Created
October 23, 2013 18:25
-
-
Save lennypham/7123936 to your computer and use it in GitHub Desktop.
A UIView category for debugging auto layout issues. Taken from @justin williams presentation on auto layout http://vimeopro.com/360conferences/360idev-2013/video/75232527
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <objc/objc-runtime.h> | |
#import "UIView+SGAutoLayoutExtensions.h" | |
@implementation UIView (SGAutoLayoutExtensions) | |
#ifdef DEBUG | |
- (NSString *)nsli_description | |
{ | |
return [self restorationIdentifier] ?: [NSString stringWithFormat:@"%@:%p", [self class], self]; | |
} | |
- (BOOL)nsli_descriptionIncludesPointer | |
{ | |
return [self restorationIdentifier] == nil; | |
} | |
- (NSString *)sg_description | |
{ | |
// Evil! | |
NSString *string = [self performSelector:@selector(nsli_description)]; | |
if (self.restorationIdentifier != nil) | |
{ | |
return [string stringByAppendingFormat:@" (%@)", self.restorationIdentifier]; | |
} | |
return string; | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment