国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發(fā)設(shè)計 > 正文

如何解決IOS動畫中Autolayout與ViewTransforms的沖突

2019-11-14 20:31:25
字體:
供稿:網(wǎng)友

IOS 的動畫放大與縮小,并非按照找它的中心點放大和縮小,而是左上角 。我分析了下原來是Autolayout 與View Transforms的沖突造成的。

 

- (void) addSubviewWithZoomInAnimation:(UIView*)view duration:(float)secs option:(UIViewAnimationOptions)option{// first reduce the view to 1/100th of its original dimensionCGAffineTransform trans = CGAffineTransformScale(view.transform, 0.01, 0.01);view.transform = trans;    // do it instantly, no animation[self addSubview:view];// now return the view to normal dimension, animating this tranformation[UIView animateWithDuration:secs delay:0.0 options:optionanimations:^{view.transform = CGAffineTransformScale(view.transform, 100.0, 100.0);}completion:nil];    }- (void) removeWithZoomOutAnimation:(float)secs option:(UIViewAnimationOptions)option{[UIView animateWithDuration:secs delay:0.0 options:optionanimations:^{self.transform = CGAffineTransformScale(self.transform, 0.01, 0.01);}completion:^(BOOL finished) { [self removeFromSuperview]; }];}

 



 

解決方案: 

Disable auto layout:

self.imageView.translatesAutoresizingMaskIntoConstraints = YES;

 

【1】

http://stackoverflow.com/questions/12943107/how-do-i-adjust-the-anchor-point-of-a-calayer-when-auto-layout-is-being-used/14105757#14105757


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 永昌县| 东山县| 香格里拉县| 壶关县| 兴安盟| 竹山县| 天门市| 隆昌县| 南宫市| 全椒县| 宜良县| 宜兰市| 玛曲县| 灵川县| 滕州市| 大化| 鸡东县| 隆德县| 昆山市| 梁河县| 汤原县| 兰溪市| 焉耆| 广灵县| 宁波市| 东乌珠穆沁旗| 大关县| 白朗县| 平武县| 京山县| 平罗县| 宁明县| 河南省| 繁峙县| 定结县| 廊坊市| 阿城市| 霞浦县| 宜章县| 沂南县| 湘潭县|