PDA

View Full Version : can not scroll table up and down after using animation and a navigation bar disappear




tranvutuan
Feb 4, 2012, 09:36 AM
My first view contains a button and after pressing a button, i will end up with the second view. what I have done is
FirstViewController.m
- (void)pushToWishList
{
SecondViewController *controller = [[SecondViewController alloc] initWithNibName:@"SecondView" bundle:nil ];

[UIView beginAnimations:@"flipping view" context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES];
[self.view addSubview:controller.view];
[UIView commitAnimations];
}
SecondViewController is an UIViewController such that :
SecondViewController.h
@interface SecondViewController : UIViewController <UITableViewDataSource,UITableViewDelegate>

SecondViewController.m
self.navigationController.navigationBarHidden = NO;
self.navigationItem.hidesBackButton = NO;
self.navigationController.navigationBar.tintColor = [UIColor blackColor];

What is happening is the top navigation is disppearing and the UITableView in my second view can not be scrolled up and down. My program is crashed whenever I try to do this.

Please advice me on this issue. Any comments are welcomed here.



dejo
Feb 4, 2012, 01:38 PM
Your method is called pushToWishList. Why are you not pushing the new view controller onto your navigation stack?

tranvutuan
Feb 4, 2012, 04:58 PM
Your method is called pushToWishList. Why are you not pushing the new view controller onto your navigation stack?
because I want to do an animation such that the next page will curl down

Scott90
Feb 4, 2012, 05:08 PM
You can still do that by replacing the line that adds the controller's view as a subview with pushing that view controller onto the stack.

tranvutuan
Feb 4, 2012, 06:15 PM
You can still do that by replacing the line that adds the controller's view as a subview with pushing that view controller onto the stack.
Did you meant like this
SecondViewController *controller = [[SecondViewController alloc] initWithNibName:@"SecondView" bundle:nil ];

[UIView beginAnimations:@"flipping view" context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES];
[self.view addSubview:controller.view];----------> [self.navigationController pushViewController:controller animated:YES];
[UIView commitAnimations];

Are you sure that it works. I tried and my program crashed