presentModalViewController显示半透明的一个view

 

UIViewController* transparentView = [[UIViewController alloc] init];

UIViewController* controller = self.view.window.rootViewController;

transparentView.view.backgroundColor = [UIColor blackColor];

transparentView.view.alpha = 0.5f;

controller.modalPresentationStyle = UIModalPresentationCurrentContext;

[controller presentModalViewController:transparentView animated:YES];

其要点就是使用iOS特有的rootViewController来显示Modal View

posted @ 2012-09-26 17:18  我的程序人生  阅读(244)  评论(0编辑  收藏  举报