2009-11-13 91 views

回答

15

方法如下:

//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

+0

謝謝 luvieere – Nic 2009-11-13 10:53:18

+0

嗨非常感謝, &代碼也在OS 3.0上工作。 :-) – Nic 2009-11-13 11:14:19

+0

編輯:現在它是> =操作系統3.0 – luvieere 2009-11-13 11:40:35

1

你可以在你的webView上添加一些遮罩圖像。以這樣的方式,你可以改變你的web視圖的可見部分的形式