在使用控制器做弹窗时,当需要在当前控制器页面上弹窗,而控制器在TabbarController首页时,弹窗的底部会被tabbar遮挡,这是就需要把弹窗加到window上显示.
UIViewController *vc = [[UIViewController alloc]init];
vc.providesPresentationContextTransitionStyle = YES;
vc.definesPresentationContext = YES;
[vc setModalPresentationStyle:UIModalPresentationOverCurrentContext];
AppDelegate *appdelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
appdelegate.window.rootViewController.definesPresentationContext = YES;
[appdelegate.window.rootViewController presentViewController:vc animated:NO completion:nil];
网友评论