In my application i am using a UIView
which includes UITableView
,Buttons
and Labels
in it. It created using Storyboard
. When user click a navigation bar button UIView
will appear with animation from top to certain height and if they click it again it hides the UIView with animation(From that height to top).
Same like UIActionView
.
It works fine if there is no records in UITableView
. But if it has any records, while calling [self hideBasket]
the UIView appears from bottom of the view to top(Not Hidden).
// Hide Basket Code
-(void)hideBasket{
/*Finished Hiding the Basket
[self.view sendSubviewToBack:_shoppingCartView];
[_shoppingCartView setHidden:YES];
_isShoppingCartSeen = NO;*/
CGRect basketFrame = _shoppingCartView.frame;
basketFrame.origin.y = -basketFrame.size.height;
[UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationOptionCurveEaseOut animations:^{
_shoppingCartView.frame = basketFrame;
} completion:^(BOOL finished) {
// Finished Hiding the Basket
//[self.view sendSubviewToBack:_shoppingCartView];
// [_shoppingCartView setHidden:YES];
_isShoppingCartSeen = NO;
}];
// Show Basket Code
-(void)showBasket{
/*[self.view bringSubviewToFront:_shoppingCartView];
[_shoppingCartView setHidden:NO];
_isShoppingCartSeen = YES;*/
CGRect basketFrame = _shoppingCartView.frame;
basketFrame.origin.y = 0;
[UIView animateWithDuration:1.0 delay:0.0 options:UIViewAnimationOptionCurveEaseOut animations:^{
_shoppingCartView.frame = basketFrame;
} completion:^(BOOL finished) {
// Finished Showing the Basket
[self.view bringSubviewToFront:_shoppingCartView];
[_shoppingCartView setHidden:NO];
_isShoppingCartSeen = YES;
}];
}
What i am doing wrong here?