如何在UIAlertView中添加UIWebview?

时间:2015-09-25 09:40:53

标签: ios uiwebview uialertview addsubview

我尝试使用以下代码:但我只是一个没有webview的警报视图。我应该在哪里纠正以获得正确的输出?

 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Next Action"message:nil delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];

        UIWebView *webView = [[UIWebView alloc] init];
        [webView setFrame:CGRectMake(0,0,300,300)];
        [webView loadHTMLString:[@"https://app.acuityscheduling.com/schedule.php?owner=11673736" description] baseURL:nil];
        [alert addSubview:webView];
        [alert show];

1 个答案:

答案 0 :(得分:9)

您必须将UIWebView添加为UIView的子视图,并将UIView设置为accessoryView的{​​{1}}。

试试这种方式

UIAlertView