Modal效果

Modal即另一个ViewController对象从屏幕底部弹出覆盖全屏

要弹出一个ViewController

- (void)modalStart
{
    ModalViewController *modalVC = [[ModalViewController alloc]init];

    [self presentViewController:modalVC animated:YES completion:^{
        NSLog(@"modal 完成");
    }];
}

此时新的ViewController其实是添加到UIWindow中的

如果要将这个ViewController移除,在ViewController自身写个方法

[self dismissViewControllerAnimated:YES completion:^{
    NSLog(@"modal dismissed");
}];

results matching ""

    No results matching ""