最近研究下Mac開發(fā)的一些技巧,有興趣的朋友關(guān)注我就對了!
爭取在工作之余把Mac開發(fā)給拿下!
//初始化NSImageView并設(shè)置它的大小
NSImageView *imgView = [[NSImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width/2-35, 100, 70, 70)];
//給圖片賦值和iOS開發(fā)是一樣的
imgView.image = [NSImage imageNamed:@"1"];
[self.view addSubview:imgView];
//設(shè)置圓角
imgView.wantsLayer = YES;
imgView.layer.cornerRadius = 35.0f;
imgView.layer.borderWidth = 2;
imgView.layer.borderColor = [NSColor greenColor].CGColor;
imgView.layer.masksToBounds = YES;
最終效果圖如下

NSimgView.png
推薦一款學習iOS開發(fā)的app_____|______| | 傳送門
技術(shù)交流群:534926022(免費) 511040024(0.8/人付費)
版權(quán)歸?Bison所有 如需轉(zhuǎn)載請保留原文超鏈接地址!否則后果自負!