为什么我的 UIView 在加载完成后不保持透明?

发布于 2024-09-17 14:46:14 字数 501 浏览 2 评论 0原文

我有一个以模态方式显示的视图,在显示它之前,我将其背景颜色设置为透明...

- (void)viewDidAppear:(BOOL)animated
{
 [super viewDidAppear:animated];

 MyViewController_iPhone *myVC = [[MyViewController_iPhone alloc] initWithNibName:@"MyView" bundle:nil];
 [myVC.view setBackgroundColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:0.0]]
 [[self navigationController] presentModalViewController:myVC animated:YES];
 [myVC release];
}

当视图在屏幕上动画时,背景是透明的,但一旦完成向上动画,视图的背景回到原来不透明的白色,为什么?

预先感谢您的帮助!

I have a view being displayed modally and, before I display it, I set it's background color to transparent...

- (void)viewDidAppear:(BOOL)animated
{
 [super viewDidAppear:animated];

 MyViewController_iPhone *myVC = [[MyViewController_iPhone alloc] initWithNibName:@"MyView" bundle:nil];
 [myVC.view setBackgroundColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:0.0]]
 [[self navigationController] presentModalViewController:myVC animated:YES];
 [myVC release];
}

As the view animates up onto the screen, the background is transparent, but as soon as it finishes animating upward, the view's background goes back to the original opaque white color, why?

Thanks in advance for your help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜清冷一曲。 2024-09-24 14:46:46

根据这篇文章 Transparent Background with a Modal UIViewController 这是无法完成的。你想最终得到什么?

此链接似乎描述了您想要实现的目标。 http://doganberktas.com/2010/05 /18/adding-transparent-modal-view-programatically-iphone/

According to this post Transparent Background with a Modal UIViewController it cannot be done. What are you trying to end up with?

This link seems to describe what you're trying to achieve. http://doganberktas.com/2010/05/18/adding-transparent-modal-view-programatically-iphone/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文