具體的實現是使用QuartzCore庫,下面我具體的描述一下實現過程:
- 首先創建一個項目,名字叫:ipad_webwiew
- 利用Interface Builder添加一個UIWebView,然後和相應的代碼相關聯
- 添加QuartzCore.framework
代碼實現:
頭文件:
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
@interface ipad_webwiewViewController : UIViewController {
IBOutlet UIWebView *myWebView;
UIView *myView;
}
@property (nonatomic,retain) UIWebView *myWebView;
@end
代碼實現:
- (void)viewDidLoad { [super viewDidLoad]; //給圖層添加背景圖片: //myView.layer.contents = (id)[UIImage imageNamed:@"view_BG.png"].CGImage; //將圖層的邊框設置爲圓腳 myWebView.layer.cornerRadius = 8; myWebView.layer.masksToBounds = YES; //給圖層添加一個有色邊框 myWebView.layer.borderWidth = 5; myWebView.layer.borderColor = [[UIColor colorWithRed:0.52 green:0.09 blue:0.07 alpha:1] CGColor]; }