문제

Instead of doing self.view = view; like I am currently I want to present this view with animation. It is not an entire view controller but just a view, I am just replacing the current view with this view on a button click.

Is there anyway to do this animated?

Thanks in advance.

도움이 되었습니까?

해결책

Try something like:

UIView *newView = ...;
// new view is added as a subview somewhere

newView.alpha = 0;

[UIView animateWithDuration:1
                 animations:^{
    newView.alpha = 1;
}];

Which will fade the view in. You could also look at animateWithDuration:delay:options:animations:completion: which provides other animation options. Or transitionFromView:toView:duration:options:completion:.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top