Created
June 12, 2013 17:53
-
-
Save C4Code/5767573 to your computer and use it in GitHub Desktop.
embedding objects in another object and rotating them.
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
// | |
// C4WorkSpace.m | |
// centered | |
// | |
// Created by moi on 13-06-12. | |
// Copyright (c) 2013 moi. All rights reserved. | |
// | |
#import "C4WorkSpace.h" | |
@implementation C4WorkSpace | |
-(void)setup { | |
NSInteger gap = 10; | |
CGFloat squareWidth = 50; | |
CGFloat containerWidth = 6 * gap + 6 * squareWidth; | |
C4Shape *container = [C4Shape rect:CGRectMake(0, 0, containerWidth, containerWidth)]; | |
container.lineWidth = 0; | |
container.fillColor = [UIColor clearColor]; | |
for(int i = 0; i < 36; i++) { | |
CGFloat x = i%6 * (squareWidth + gap); | |
CGFloat y = i/6 * (squareWidth + gap); | |
C4Shape *rect = [C4Shape rect:CGRectMake(x, y, squareWidth, squareWidth)]; | |
[container addShape:rect]; | |
} | |
[self.canvas addShape:container]; | |
container.center = self.canvas.center; | |
container.borderWidth = 1.0f; | |
container.rotation = QUARTER_PI; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment