2012-02-04 139 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