gpt4 book ai didi

ios - 如何在 iOS 7 的 UIAlertView 中添加 subview ?

转载 作者:IT王子 更新时间:2023-10-29 08:01:50 25 4
gpt4 key购买 nike

我在 iTunes 商店上有一个应用程序,它在 UIAlertView 上显示一些 UILabelUIWebView。根据 session 视频,UIAlertViewaddSubView 将不起作用。他们讨论了 ContentView。但在 GM Seeds SDK 中,我找不到该属性,似乎没有其他办法。

我唯一能做的就是创建 UIView 的自定义子类,并使其像 UIAertView 一样工作。你能推荐任何其他简单的解决方案吗?

感谢您的帮助。

最佳答案

你真的可以在 iOS7 中将 accessoryView 更改为 customContentView(似乎在 iOS8 中也是如此)UIAlertView

[alertView setValue:customContentView forKey:@"accessoryView"];

试试这段代码:

UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"TEST" message:@"subview" delegate:nil cancelButtonTitle:@"NO" otherButtonTitles:@"YES", nil];
UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 80, 40)];
[av setValue:v forKey:@"accessoryView"];
v.backgroundColor = [UIColor yellowColor];
[av show];

请记住,您需要在调用[alertView show]

之前设置自定义 accessoryView

enter image description here

关于ios - 如何在 iOS 7 的 UIAlertView 中添加 subview ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18759206/

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