Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

tranvutuan

macrumors member
Original poster
Dec 19, 2011
74
0
My first view contains a button and after pressing a button, i will end up with the second view. what I have done is
Code:
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 :
Code:
SecondViewController.h
@interface SecondViewController : UIViewController <UITableViewDataSource,UITableViewDelegate>

Code:
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.
 
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
 
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.
 
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:mad:"SecondView" bundle:nil ];

[UIView beginAnimations:mad:"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
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.