2016-10-27 2 views
0

: 애니메이션이 작동하지'commitAnimations'I 버튼 클릭 이벤트에 추가

[UIView beginAnimations:nil context:nil]; 
sender.titleLabel.font = [UIFont systemFontOfSize:18]; 
[UIView commitAnimations]; 

. 그러나 [UIView commitAnimations];을 제거하면 애니메이션이 작동합니다. 왜?

[UIView commitAnimations];을 추가하지 않으면 어떻게됩니까?

+0

이러한 메소드는 더 이상 사용되지 않습니다. 블록 기반 버전의 'UIView'애니메이션을 사용하십시오. http://stackoverflow.com/questions/11723545/use-of-beginanimation-diplouged – rmaddy

+0

답장을 보내 주셔서 감사합니다. '[UIView animateWithDuration : <# (NSTimeInterval) #> animations : <#^(void) animations # > 완료 : <#^(BOOL finished) completion #>] '또한 작동하지 않습니다 – LisonFan

+0

'UILabel font'는 (는) 애니메이션 가능한 속성이 아닙니다. http://stackoverflow.com/questions/14494566/animating-uilabel-font-size-change?s=1|1.6166 – rmaddy

답변

0

왜보기 애니메이션에 이것을 사용하지 않으십니까?

[UIView animateWithDuration:1.0 animations:^{ 
    // place your animations code here 
}]; 

참고 :이 URL을 방문하여을 애니메이션 할 수있는 일 섹션 를 참조하십시오. 단지 몇 가지 속성 애니메이션

https://developer.apple.com/library/content/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/AnimatingViews/AnimatingViews.html

이 시도 사용할 수 있습니다, 그것은 도움이 될 것입니다. 아래 예제에서 viewObject는 사건의 레이블 일 수 있습니다.

[UIView animateWithDuration:1.0 animations:^{ 
    viewObject.transform = CGAffineTransformMakeScale(1.5, 1.5); 
}]; 
관련 문제