ios - CALayer breaks in landscape mode -


i coding custom transition based on shutter transition tutorial. it's pretty simple, first view controller meant divide hundreds of pieces , fade 1 @ time, problem doesn't work in landscape mode. apparently "contentsrect" method of calayer (which supposed work on normalized image space) works in portrait mode. have attached file in here if needs have , please if can me.

http://tinyurl.com/88669oy

regards

here trans code:

calayer*        viewlayer;  - (void)transitwithimageview:(uiimageview *)imgview inview:(uiview *)view withimage:(uiimage *)img {      viewlayer = [imgview layer];     [view.layer addsublayer:viewlayer];       cgsize layersize = viewlayer.bounds.size;       // begining of make array of transitions     nsmutablearray* alltransitionsarr = [[nsmutablearray alloc] init];         ( int = 0; < block_count; i++ )     {         cabasicanimation *fade = [cabasicanimation animationwithkeypath:@"opacity"];         fade.tovalue =   [nsnumber numberwithfloat:-1-sqrt(i)];         fade.autoreverses = no;         fade.duration = duration;         [alltransitionsarr addobject: fade];     }     // end of make array of transitions        nsmutablearray *blocks = [[nsmutablearray alloc] init];          [viewlayer removefromsuperlayer];         [catransaction begin];      [catransaction setcompletionblock:^(void)       {          [blocks enumerateobjectsusingblock:^(id obj, nsuinteger idx, bool *stop)            {               [obj setdelegate:nil];               [obj removefromsuperlayer];           }];          [view.layer addsublayer:viewlayer];      }];      cgfloat bandwidth   = layersize.width / sqrt(block_count);     cgfloat bandheight  = layersize.height / sqrt(block_count);       int yval = -1;      for(int = 0; < block_count; i++)     {         calayer *block = [[calayer alloc] init];         block.maskstobounds = yes;         cgfloat xoffset = 1.f / sqrt(block_count);         cgfloat yoffset = 1.f / sqrt(block_count);         block.bounds = cgrectmake(0, 0, bandwidth, bandheight);         block.bounds = cgrectmake(0.f, 0.f, bandwidth, bandheight);         block.contents = (id)[img cgimage];         block.contentsgravity = kcagravitycenter;          cgpoint bandorigin = viewlayer.frame.origin;         bandorigin.x = bandorigin.x + (bandwidth * (i % (int)sqrt(block_count)));          if (i % (int)sqrt(block_count) == 0 )             yval++;          bandorigin.y = bandorigin.y + (bandheight * yval);          // problem got here         block.contentsrect = cgrectmake(xoffset * (i % (int)sqrt(block_count)) ,yoffset * yval, xoffset, yoffset);          [block setvalue:[nsvalue valuewithcgpoint:bandorigin] forkeypath:@"frame.origin"];          [view.layer addsublayer:block];         [block addanimation:[alltransitionsarr objectatindex: block_count - - 1] forkey:nil];         [blocks addobject:block];         [block release];     }     [catransaction commit];     [blocks release]; } 


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -