gpt4 book ai didi

iphone - 将 UIButton 放在全屏 UIWebView 上以在 UIWebView 加载失败时将其关闭

转载 作者:行者123 更新时间:2023-12-01 19:24:31 25 4
gpt4 key购买 nike

我的 iOS 应用中有插页式全屏广告。我无法控制广告的 HTML 代码。我不想修改广告网络提供的广告代码。
有时由于网络问题而无法加载广告。
没有办法关闭兴趣。之后应用程序无法使用。

我希望将原生关闭 UIButton 放在 UIWebView 上。
我不使用 IB,我必须以编程方式制作这样的按钮。

怎么做?

最佳答案

例如,

UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self
action:@selector(closeAd:)
forControlEvents:UIControlEventTouchUpInside];
[button setTitle:@"Close" forState:UIControlStateNormal];
button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
[view addSubview:button];

然后在方法中放入你喜欢的任何代码
-(void)closeAd:(id)sender;

关于iphone - 将 UIButton 放在全屏 UIWebView 上以在 UIWebView 加载失败时将其关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8497647/

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