Reputation: 723
I am working on iPhone application. I am having a MemoryViewController page on which I have to display questions to the user for a particular time period. I have to reload same view with new question again and again. Here I have to apply view animation in the form of right to left move. and the new view will contain new question.
Have I to take 2 different views on the same parent view? or it can be implemented with same view.
Any code help, please.
Thanks.
Upvotes: 2
Views: 2778
Reputation: 25907
I would make them in two different views, so you would end up with something like:
newQuestionView.frame=CGRectMake(360.0,0.0,newQuestionView.frame.size.width,newQuestionView.frame.size.height);
[UIView animateWithDuration:1
animations:^{
oldQuestion.frame=CGRectMake(-360.0, 0.0, oldQuestion.frame.size.width, oldQuestion.frame.size.height);
newQuestionView.frame=CGRectMake(0.0, 0.0, newQuestionView.frame.size.width, newQuestionView.frame.size.height);
}];
What will happen is:
animateWithDuration:1
, you can change the 1 to whatever time you want the animation to last.Upvotes: 3