gpt4 book ai didi

ios - 如何在 iOS 应用程序中为 iFrame 设置透明背景?

转载 作者:行者123 更新时间:2023-11-28 23:10:55 25 4
gpt4 key购买 nike

我有一个显示 iFrame 的 UIWebView,我将 webview 设置为透明颜色,并将 iFrame 设置为透明,但出于某种原因,我仍然得到一个白色 block 而不是清晰的 iFrame。还有什么我需要做的吗?

iFrame 代码:

<iframe src=\"http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2FmySite&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21&amp;appId=31301291871XXXX\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:125px; height:40px;\" allowTransparency=\"true\"></iframe>

iOS 代码:

NSString *likeButtonHtml = [NSString stringWithFormat:@"<HTML><BODY>%@</BODY></HTML>", likeButtonIframe];   

UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(650, 95, 125, 40)];

[webView setBackgroundColor:[UIColor clearColor]];
[webView loadHTMLString:likeButtonHtml baseURL:[NSURL URLWithString:@""]];

[self.view addSubview:webView];

感谢您的帮助。

最佳答案

试试这个:

webView.opaque = NO;

您可能还需要在您的 HTML 中使用它:

<style>body {background-color: transparent;}</style>

关于ios - 如何在 iOS 应用程序中为 iFrame 设置透明背景?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8298413/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com