iOS开发中UITabBarController的使用示例

2020-01-14 16:38:32王冬梅

    modalShowVC.modalTransitionStyle =UIModalTransitionStyleCrossDissolve;
    /*
     UIModalTransitionStyleCoverVertical = 0,   //默认,由下往上
     UIModalTransitionStyleFlipHorizontal,      //水平转动效果
     UIModalTransitionStyleCrossDissolve,       //渐变效果
     UIModalTransitionStylePartialCurl,         //书页往上翻动效果
     */
    //模态视图控制器呈现方式,默认全屏
    modalShowVC.modalPresentationStyle =UIModalPresentationFullScreen;
    /*    
     UIModalPresentationFullScreen = 0,
     UIModalPresentationPageSheet,
     UIModalPresentationFormSheet,
     UIModalPresentationCurrentContext,
     UIModalPresentationCustom,
     UIModalPresentationNone = -1,    
     */
    
    UINavigationController * modalShowNC = [[UINavigationController alloc] initWithRootViewController:modalShowVC];
    
    //推出模态视图控制器
    [self presentViewController:modalShowNC animated:YES completion:^{
        NSLog(@"hello world");       
    }];
}


#import "HMTModalShowViewController.h"

@interfaceHMTModalShowViewController ()

@end

@implementation HMTModalShowViewController

- (void)viewDidLoad
{
    [superviewDidLoad];
// Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor yellowColor];
    
    // 利用UINavigationController来实现退出控制器
    UIBarButtonItem * barButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(modalDismiss)];
    
    self.navigationItem.leftBarButtonItem = barButton;
    self.navigationItem.title =@"humingtao";
    
    //创建一个按钮来实现退出控制器