Created
December 17, 2011 15:24
-
-
Save pita5/1490483 to your computer and use it in GitHub Desktop.
This file contains 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
- (void)doLayout | |
{ | |
if (_data) | |
{ | |
NSMutableArray *frameArray = [[_data objectForKey:@"rects"] mutableCopy]; | |
id toRemove = nil; | |
for (NSMutableDictionary *info in frameArray) | |
{ | |
if (![[info objectForKey:@"selectable"] boolValue]) | |
{ | |
NSMutableDictionary *infoCopy = [info mutableCopy]; | |
CGRect infoRect = CGRectFromString([infoCopy objectForKey:@"rect"]); | |
CGPathRef textPath = CGPathCreateWithRect(infoRect, NULL); | |
CGMutablePathRef mutPath = CGPathCreateMutableCopy(textPath); | |
[infoCopy setObject:(id)mutPath | |
forKey:@"path"]; | |
CGPathRelease(textPath); | |
CGPathRelease(mutPath); | |
[self setBaseFrame:infoCopy]; | |
toRemove = info; | |
} | |
} | |
if (_baseFrame) | |
{ | |
CGMutablePathRef _baseFramePath = (CGMutablePathRef)[_baseFrame objectForKey:@"path"]; | |
[frameArray removeObject:toRemove]; | |
for (NSMutableDictionary *info in frameArray) | |
{ | |
CGRect infoRect = CGRectFromString([info objectForKey:@"rect"]); | |
CGPathRef textPath = CGPathCreateWithRect(infoRect, NULL); | |
[info setObject:(id)textPath forKey:@"path"]; | |
if (![[info objectForKey:@"floating"] boolValue]) | |
{ | |
CGPathAddPath(_baseFramePath, NULL, textPath); | |
} | |
} | |
} | |
CGMutablePathRef _baseFramePath = (CGMutablePathRef)[_baseFrame objectForKey:@"path"]; | |
NSMutableArray *points = [NSMutableArray array]; | |
CGPathApply(_baseFramePath, points, clipApplier); | |
[self setFrames:frameArray]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment