Reputation: 5208
I am using following code to animate the appearance of selectionMoreOptionView
[selectionMoreOptionView setFrame:CGRectMake(974, 56, 50, 0)];
[self.view insertSubview:selectionMoreOptionView aboveSubview:lightBoxView];
[lightBoxView setAlpha:0.0];
[UIView animateWithDuration:5.0
delay:0.0
options:UIViewAnimationOptionCurveLinear
animations:^{
[lightBoxView setAlpha:0.5];
[selectionMoreOptionView setFrame:CGRectMake(974, 56, 50, 100)];
} completion:^(BOOL finished) {
}];
But it is not animating instead it just appears at once without animating. What i am doing wrong?
Upvotes: 2
Views: 1300
Reputation: 5208
The animation was working fine the problem was that i had two buttons inside the view big enough to cover all of the view. The views property Clip Subviews was unchecked. I had thought when a parent resizes it effects its child's automatically, but it don't in some cases when parent do not clip its subviews. Thanks everybody for your reply :)
Upvotes: 1
Reputation: 12719
Simply try this
[UIView animateWithDuration:.5 animations:^(void){
[lightBoxView setAlpha:0.5];
[selectionMoreOptionView setFrame:CGRectMake(974, 56, 50, 100)];
}];
Upvotes: 1
Reputation: 4561
check your
[selectionMoreOptionView setFrame:CGRectMake(974, 56, 50, 100)];
I think XY co-ordinates going out of viewController. Try to bring it in the ViewController area,as of X should be possibly less than 320 and y<480 so that you can see your view.
Upvotes: 0