Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSMutableArray *changeSubtree(NSMutableArray *result)
- {
- if ([result count] == 3) {
- for(int k = 0; k < 3; k++) {
- id myobject = [result objectAtIndex:k];
- if ([myobject isKindOfClass: [UIKBTree class]]) {
- UIKBTree *mykbtree = (UIKBTree *)myobject;
- UIKBTree *new_mykbtree = [[UIKBTree alloc] init];
- new_mykbtree = [mykbtree copy];
- mykbtree = new_mykbtree;
- NSMutableArray *resultz = [[NSMutableArray alloc] initWithArray:mykbtree.subtrees];
- mykbtree.subtrees = resultz;
- NSMutableArray *resultx = mykbtree.subtrees;
- if([resultx count] == 3){
- UIKBTree *mykbtree_r1 = [resultx objectAtIndex:0];
- NSMutableArray *resulty = [[NSMutableArray alloc] initWithArray:mykbtree_r1.subtrees];
- mykbtree_r1.subtrees = resulty;
- id myobject1 = [mykbtree_r1.subtrees objectAtIndex:0];
- if([mykbtree_r1.subtrees count] == 11){
- if ([myobject1 isKindOfClass: [UIKBShape class]]) {
- [resulty addObject: [[resulty objectAtIndex:0] copy]];
- [resulty addObject: [[resulty objectAtIndex:1] copy]];
- [resulty addObject: [[resulty objectAtIndex:2] copy]];
- [resulty addObject: [[resulty objectAtIndex:3] copy]];
- [resulty addObject: [[resulty objectAtIndex:4] copy]];
- [resulty addObject: [[resulty objectAtIndex:5] copy]];
- [resulty addObject: [[resulty objectAtIndex:6] copy]];
- [resulty addObject: [[resulty objectAtIndex:7] copy]];
- [resulty addObject: [[resulty objectAtIndex:8] copy]];
- [resulty addObject: [[resulty objectAtIndex:9] copy]];
- [resulty addObject: [[resulty objectAtIndex:10] copy]];
- [resulty addObject: [[resulty objectAtIndex:10] copy]];
- for(int i = 11; i < 23; i++) {
- id myobject2 = [resulty objectAtIndex:i];
- if ([myobject2 isKindOfClass: [UIKBShape class]]) {
- UIKBShape *myshape = (UIKBShape *)myobject2;
- CGRect rect;
- if(layout != nil && (layout.orientation == 3 || layout.orientation == 4)) {
- if(i == 22)
- rect=CGRectMake(890, 68, 73, 62);
- else
- rect=CGRectMake(myshape.frame.origin.x, 68, 73, 62);
- } else {
- if(i == 22)
- rect=CGRectMake(671, 52, 55, 50);
- else
- rect=CGRectMake(myshape.frame.origin.x, 52, 55, 50);
- }
- myshape.frame = rect;
- myshape.paddedFrame = rect;
- }
- }
- for(int i = 0; i < 11; i++) {
- id myobject2 = [resulty objectAtIndex:i];
- if ([myobject2 isKindOfClass: [UIKBShape class]]) {
- UIKBShape *myshape = (UIKBShape *)myobject2;
- CGRect rect;
- if(layout != nil && (layout.orientation == 3 || layout.orientation == 4)) {
- rect=CGRectMake(myshape.frame.origin.x, 5, 73, 61);
- } else {
- rect=CGRectMake(myshape.frame.origin.x, 3, 55, 50);
- }
- myshape.paddedFrame = rect;
- }
- }
- }
- }
- UIKBTree *mykbtree_r2 = [resultx objectAtIndex:1];
- resulty = [[NSMutableArray alloc] initWithArray:mykbtree_r2.subtrees];
- mykbtree_r2.subtrees = resulty;
- if([mykbtree_r2.subtrees count] == 11){
- for(int i = 0; i < 11; i++) {
- id myobject2 = [resulty objectAtIndex:i];
- if ([myobject2 isKindOfClass: [UIKBShape class]]) {
- UIKBShape *myshape = (UIKBShape *)myobject2;
- CGRect rect;
- if(layout != nil && (layout.orientation == 3 || layout.orientation == 4))
- rect=CGRectMake(myshape.frame.origin.x, 136, 73, 63);
- else
- rect=CGRectMake(myshape.frame.origin.x, 101, 55, 50);
- myshape.paddedFrame = rect;
- }
- }
- }
- UIKBTree *mykbtree_r3 = [resultx objectAtIndex:2];
- resulty = [[NSMutableArray alloc] initWithArray:mykbtree_r3.subtrees];
- mykbtree_r3.subtrees = resulty;
- if([mykbtree_r3.subtrees count] == 10){
- for(int i = 0; i < 10; i++) {
- id myobject2 = [resulty objectAtIndex:i];
- if ([myobject2 isKindOfClass: [UIKBShape class]]) {
- UIKBShape *myshape = (UIKBShape *)myobject2;
- CGRect rect;
- if(layout != nil && (layout.orientation == 3 || layout.orientation == 4))
- rect=CGRectMake(myshape.frame.origin.x, 204, 73, 62);
- else
- rect=CGRectMake(myshape.frame.origin.x, 150, 55, 50);
- myshape.paddedFrame = rect;
- }
- }
- }
- }
- }
- }
- }
- if ([result count] == 4) {
- for(int k = 0; k < 4; k++) {
- id myobject = [result objectAtIndex:k];
- if ([myobject isKindOfClass: [UIKBTree class]]) {
- UIKBTree *mykbtree = (UIKBTree *)myobject;
- NSMutableArray *resultx = [[NSMutableArray alloc] initWithArray:mykbtree.subtrees];
- mykbtree.subtrees = resultx;
- if([resultx count] == 1){
- for(int i = 0; i < 1; i++) {
- id myobject2 = [resultx objectAtIndex:i];
- if ([myobject2 isKindOfClass: [UIKBShape class]]) {
- UIKBShape *myshape = (UIKBShape *)myobject2;
- CGRect rect;
- if(layout != nil && (layout.orientation == 3 || layout.orientation == 4))
- rect=CGRectMake(900, 5, 110, 61);
- else
- rect=CGRectMake(671, 3, 90, 50);
- myshape.paddedFrame = rect;
- }
- }
- }
- if([resultx count] == 2){
- for(int i = 0; i < 2; i++) {
- id myobject2 = [resultx objectAtIndex:i];
- if ([myobject2 isKindOfClass: [UIKBShape class]]) {
- UIKBShape *myshape = (UIKBShape *)myobject2;
- CGRect rect;
- if(layout != nil && (layout.orientation == 3 || layout.orientation == 4))
- rect=CGRectMake(myshape.frame.origin.x, 204, 73, 62);
- else
- rect=CGRectMake(myshape.frame.origin.x, 150, 55, 50);
- myshape.paddedFrame = rect;
- }
- }
- }
- }
- }
- }
- return result;
- }
Add Comment
Please, Sign In to add comment