Objective C iOS - Crossfade size transition for UILabel -


i trying make custom uiview in label on view starts two-line preview of text, grows size of text when view pulled down make room bigger label. want transition crossfade between 2 sizes. if set frame inside animation block, animates label coming in off-screen @ new size instead of crossfading. if put in completion block, doesn't crossfade animate @ all. i'm sure doing dumb, here. note using transitionwithview in example code below, same thing happens animatewithduration...

cgsize newsize = [self.label.text boundingrectwithsize:cgsizemake(self.label.frame.size.width, maxfloat)                                                     options:nsstringdrawinguseslinefragmentorigin                                                  attributes:@{                                                               nsfontattributename : self.label.font                                                               }                                                     context:nil].size;  cgrect newrect = cgrectmake(self.label.frame.origin.x, self.label.frame.origin.y, self.label.frame.size.width, newsize.height);  [uiview transitionwithview:self duration:0.3 options:uiviewanimationoptiontransitioncrossdissolve animations:^{         self.label.numberoflines = 0;     } completion:^(bool finished) {          self.label.frame = newrect;         self.label.backgroundcolor = [uicolor orangecolor];     }]; 


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -