2012-01-22 33 views
0

我該如何垂直翻轉一個UIViewController,它是與模式一起呈現的UINavigationController和完成按鈕。如何垂直翻轉UIViewController,它是以模態形式呈現的

這是我如何呈現UIViewController模態:

- (void)modalViewAction:(id)sender 
{ 
    self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds] autorelease]; 
    [self.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; 
    _viewController = [[ModalViewController alloc] init]; 
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:_viewController]; 
    UIBarButtonItem * button = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissView:)] autorelease]; 
    [_viewController.navigationItem setLeftBarButtonItem:button animated:YES]; 
    navigationController.navigationBar.tintColor = [UIColor brownColor]; 
    [self.navigationController presentModalViewController:self.viewController animated:YES]; 
    [self.view addSubview:navigationController.view]; 
    [navigationController release]; 
} 

我如何翻轉這個UIViewController而模態呈現呢?

感謝您的幫助。

回答

1

您可以通過設置modalTransitionStyle屬性(在呈現視圖控制器之前)指定所需的動畫技巧。

不幸的是這個屬性可以被設置爲只:

UIModalTransitionStyleCoverVertical 
UIModalTransitionStyleFlipHorizontal 
UIModalTransitionStyleCrossDissolve 
UIModalTransitionStylePartialCurl 

所以垂直翻轉它不支持。

看看UIModalTransitionStyle參考: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html