iOS开发技术iOSiOS入门学习

presentViewController之系统动画

2017-05-02  本文已影响1191人  FlowYourHeart

东西多了,脑子不够存,当需要的时候,总是觉得好像知道,却又不是真的知道,去找资料,看文档都是在浪费时间。那就清理一下脑存吧。方便以后用。

present动画.gif
typedef NS_ENUM(NSInteger, UIModalTransitionStyle) {
    UIModalTransitionStyleCoverVertical = 0,
    UIModalTransitionStyleFlipHorizontal __TVOS_PROHIBITED,
    UIModalTransitionStyleCrossDissolve,
    UIModalTransitionStylePartialCurl NS_ENUM_AVAILABLE_IOS(3_2) __TVOS_PROHIBITED,
};
//UIModalTransitionStyleCoverVertical
- (IBAction)coverVertical:(id)sender {
    BViewController *bvc = [[BViewController alloc] init];
    
    bvc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    
    [self presentViewController:bvc animated:YES completion:nil];
    
}

//UIModalTransitionStyleFlipHorizontal
- (IBAction)flipHorizontal:(id)sender {
    BViewController *bvc = [[BViewController alloc] init];
    
    bvc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    
    [self presentViewController:bvc animated:YES completion:nil];
}

//UIModalTransitionStyleCrossDissolve
- (IBAction)crossDissolve:(id)sender {
    BViewController *bvc = [[BViewController alloc] init];
    
    bvc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    
    [self presentViewController:bvc animated:YES completion:nil];
}

//UIModalTransitionStylePartialCurl
- (IBAction)partialCurl:(id)sender {
    BViewController *bvc = [[BViewController alloc] init];
    
    bvc.modalTransitionStyle = UIModalTransitionStylePartialCurl;
    
    [self presentViewController:bvc animated:YES completion:nil];
}
- (void)gobackAction {
    UIViewController *rootVC = self.presentingViewController;
    UIViewController *bottomVC;
    while (rootVC) {
        bottomVC = rootVC;
        rootVC = rootVC.presentingViewController;
        
        NSLog(@"有:%s,%s",object_getClassName(bottomVC),object_getClassName(rootVC));
    }
    [bottomVC dismissViewControllerAnimated:YES completion:nil];
    
}
上一篇 下一篇

猜你喜欢

热点阅读