2012-02-04 141 views
0

我的第一个视图包含一个按钮,按下按钮后,我将以第二个视图结束。我做了什么是使用动画后导航栏不能上下滚动,导航栏消失

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是一个UIViewController中这样的:

SecondViewController.h:

@interface SecondViewController: 的UIViewController

SecondViewController.m

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

正在发生的事情是顶部导航disppearing和我的第二个观点中的UITableView不能向上和向下滚动。每当我尝试这样做时,我的程序就会崩溃。

请在这个问题上给我建议。任何意见都欢迎在这里。

回答

0

首先它更容易不addSubview:只是用这个代码把你的页面:

- (IBAction)myCart:(id)sender; { 
viewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 
[self presentModalViewController:viewController animated:YES]; 

} 

这将使你的tableView滚动!另外,如果您使用按钮调用此方法,则您的方法返回类型为void,您需要将返回类型更改为适用于按钮的IBAction