1
votes

I am trying to animate my uitoolbar. I am trying to expand and contract my uiview. i want the toolbar to animated along with the view. But here the uitoolbar expands and contracts first then the uiview is animating. So the uitoolbar frame is changing according to the rect but its not animating. can somebody please tell me if how to animate uitoolbar. Along with the toolbar i also want to animate the tabbar. how should i go about doing this.

In my view i have written the following code :

 [UIView animateWithDuration:1.0 animations:^(void){

        [recordDetailView setFrame:CGRectMake(0.0, 0.0, self.view.frame.size.width, recordDetailView.frame.size.height)];
        [normalModeToolbar setFrame:CGRectMake(0.0, 0.0,self.view.frame.size.width, 49)];
        [self.view bringSubviewToFront:recordDetailView];
    } completion:^(BOOL finished){
    }
     ];
2

2 Answers

1
votes

UIViewAnimationOptionLayoutSubviews (iOS > 4.0) should fix the problem when the size change is not being animated.

[UIView animateWithDuration:1.0 
        delay:0 
        options:UIViewAnimationOptionLayoutSubviews 
        animations:^{
           [recordDetailView setFrame:CGRectMake(0.0, 0.0, self.view.frame.size.width,                 recordDetailView.frame.size.height)];
           [normalModeToolbar setFrame:CGRectMake(0.0, 0.0,self.view.frame.size.width, 49)];
       }
        completion:nil
];
0
votes

Have you tried to use bounds instead?

[UIView animateWithDuration:1.0 animations:^(void){
    yourView.bounds = CGRectMake(yourView.bounds.origin.x, 
                                 yourView.bounds.origin.y, 
                                 yourView.bounds.size.width * 2, // target width 
                                 yourView.bounds.size.height);
}];

Furthermore I would also try bringing your recordDetailView to front before starting the animation.