我正在开发照片预览组件。现在我遇到了一个显示modalViewController的问题:当我想显示一个预览视图时,我正在做的是这样的:
UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
EKImageViewer *viewer = [[EKImageViewer alloc] initWithFrame:frame];
[window addSubview:viewer];
[window addSubview:viewer.preview];
[window addSubview:viewer.shareBtn];//A UIButton control
关闭预览视图时,我在做什么是这样的:
[viewer.shareBtn removeFromSuperview];
[viewer.preview removeFromSuperview];
[viewer removeFromSuperview];
在预览组件中点击 shareBtn(UIButton) 时,我想显示一个模式视图(MFMailComposeViewController):
MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[[[[[UIApplication sharedApplication] delegate] window] rootViewController] presentModalViewController:controller animated:YES];
发生了一些奇怪的事情:modalViewController 显示在预览组件下。只有当我关闭预览组件时,我才能看到 modalViewController。有什么我错了吗?