Created
January 11, 2012 15:03
-
-
Save PsychoH13/1595076 to your computer and use it in GitHub Desktop.
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
| - (NSArray *)TS_addRotationFrameViews; | |
| { | |
| UIView *baseView = containerView; | |
| CGRect bounds = [baseView bounds]; | |
| CGFloat halfWidth = ceilf(CGRectGetWidth(bounds) / 2.0f); | |
| CGFloat halfHeight = ceilf(CGRectGetHeight(bounds) / 2.0f); | |
| UIView *topView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMinX(bounds), | |
| CGRectGetMinY(bounds) - halfHeight, | |
| CGRectGetWidth(bounds), | |
| halfHeight)]; | |
| UIView *bottomView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMinX(bounds), | |
| CGRectGetMaxY(bounds), | |
| CGRectGetWidth(bounds), | |
| halfHeight)]; | |
| UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMinX(bounds) - halfWidth, | |
| CGRectGetMinY(bounds), | |
| halfWidth, | |
| CGRectGetHeight(bounds))]; | |
| UIView *rightView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(bounds), | |
| CGRectGetMinY(bounds), | |
| halfWidth, | |
| CGRectGetHeight(bounds))]; | |
| [topView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin]; | |
| [bottomView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin]; | |
| [leftView setAutoresizingMask:UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleRightMargin]; | |
| [rightView setAutoresizingMask:UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin]; | |
| [baseView addSubview:topView]; | |
| [baseView addSubview:bottomView]; | |
| [baseView addSubview:leftView]; | |
| [baseView addSubview:rightView]; | |
| NSArray *ret = [NSArray arrayWithObjects:(id[]){ topView, bottomView, leftView, rightView } count:4]; | |
| [ret setValue:[UIColor blackColor] forKey:@"backgroundColor"]; | |
| return ret; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment