gpt4 book ai didi

iphone - 如何制作带有圆角矩形角的webview?

转载 作者:行者123 更新时间:2023-12-03 18:34:54 25 4
gpt4 key购买 nike

我想要带有圆角矩形角的网页 View 。

有什么帮助吗?

最佳答案

方法如下:

//first, you
#import <QuartzCore/QuartzCore.h>

//.....

//In your method, where you add your UIWebView, do:
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(50, 220, 200, 100)];

//The rounded corner part:
webView.layer.cornerRadius = 5;
webView.clipsToBounds = YES;

//Load a web site:
[webView loadRequest: [NSURLRequest requestWithURL:
[NSURL URLWithString:@"http://www.stackoverflow.com/"]]];

//yourView is the UIView's superview, might be the window, or anything you want
[yourView addSubview: webView];
[webView release];

这使用了 QuartzCore 框架,并且仅适用于 >= OS 3.0

关于iphone - 如何制作带有圆角矩形角的webview?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1727201/

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