Created
December 15, 2011 04:52
-
-
Save mkdynamic/1479884 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
[selection sortedArrayUsingComparator:^(MKShape *a, MKShape *b) { | |
float leftEdgeA = NSMinX([a frame]); | |
float leftEdgeB = NSMinX([b frame]); | |
if (leftEdgeA < leftEdgeB) { | |
return (NSComparisonResult)NSOrderedAscending; | |
} else if (leftEdgeA > leftEdgeB) { | |
return (NSComparisonResult)NSOrderedDescending; | |
} else { | |
return (NSComparisonResult)NSOrderedSame; | |
} | |
}]; |
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
selection.sort_by { |shape| min_x(shape.frame) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment