iOS版:ModalView背景透明? [英] iOS : ModalView with background transparent?

查看:222
本文介绍了iOS版:ModalView背景透明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要显示在一个的viewController modalview。 (它有一个naviguation控制器)。

I want to show a modalview on a viewController. (which has a naviguation controller).

在我看来,我有文本,和一个按钮来显示modalview。

On my view i have text, and a button to show the modalview.

我创建了包含我的modalview(它与图像和标签的视图)。

I created a .xib which contained my modalview (it's a view with an image and a label).

当我表现出来,与:

ShareController *controller =  [[ShareController alloc] initWithNibName:@"ShareController" bundle: nil];
controller.view.backgroundColor = [UIColor clearColor];
controller.modalPresentationStyle = UIModalPresentationFormSheet;
controller.modalTransitionStyle = UIModalTransitionStyleCoverVertical;

[self presentViewController:controller animated:YES completion:nil];

我有我的modalview,但是,背景变成黑色..我希望看到总是在我的看法中的文本。 (我试过设置阿尔法等..;但没有运行:'()

i have my modalview, BUT, the background become black.. and i want to see always the text on my view. (i tried to set alpha, etc..; but NOTHING runs :'( )

有人帮我吗?

谢谢,

推荐答案

您可以检查iOS7的例子(见我的COMM),或者你可以试试这个简单的:

you can check the iOS7 example (see my comm) or you can simple try this:

从presenting的方法删除此行

remove this line from your "presenting" method

controller.view.backgroundColor = [UIColor clearColor];

现在,在viewDidLoad中的 ShareController 补充:

now, in viewDidLoad of the ShareController add:

 self.view.backgroundColor = [UIColor clearColor];
 self.modalPresentationStyle = UIModalPresentationCurrentContext;
 self.modalPresentationStyle = UIModalPresentationFormSheet;

PS

如果你有一个navigationController ...用

if you have a navigationController... use

[self.navigationController presentViewController:controller animated:YES completion:nil];

这篇关于iOS版:ModalView背景透明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆