Search code examples
iosipadios6

how to add animation to a second view which is inside first view in xcode for ipad using storyboard


In storyboard, in a view controller i've added a scroll view.Inside it another two different views are added & named them as "firstview" & "secondview". When i press add button from "firstview" ,it will show SecondView which is kept as hidden during the initial run. Now i want to display that view by performing some animations. How to solve this?

[UIView transitionWithView:self.secondview
                  duration:5.0f
                   options:UIViewAnimationOptionTransitionCrossDissolve
                animations:^{
                            self.secondview.alpha = 1.0f;
              } completion:NULL];

tried these but not working

Thanks in advance....


Solution

  • Try the following code if your second view is hidden

    [UIView transitionWithView:self.secondview duration:5.0f options:UIViewAnimationOptionTransitionCrossDissolve animations:^{
            self.secondview.hidden = NO;
    
        } completion:^(BOOL finished) {
            self.secondview.alpha = 1.0f;
    
        }];