给ios自带控件添加圆角边的方法

代码实现:

头文件:

    #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];
    }

posted @ 2011-05-20 17:25  冷愤僧  阅读(2602)  评论(0编辑  收藏  举报