"iOS技术分享,iOS开发,iOS开发技巧,iOS开发博客" Bison
冰之依韩版女装(程序媛福利)
最近研究下Mac开发的一些技巧,有兴趣的朋友关注我就对了! 争取在工作之余把Mac开发给拿下!
//初始化NSImageView并设置它的大小
NSImageView *imgView = [[NSImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width/2-35, 100, 70, 70)];
//给图片赋值和iOS开发是一样的
imgView.image = [NSImage imageNamed:@"1"];
[self.view addSubview:imgView];
//设置圆角
imgView.wantsLayer = YES;
imgView.layer.cornerRadius = 35.0f;
imgView.layer.borderWidth = 2;
imgView.layer.borderColor = [NSColor greenColor].CGColor;
imgView.layer.masksToBounds = YES;
最终效果图如下
好文推荐:iOS开发内购全套图文教程
原文在:http://www.allluckly.cn/
版权归©Bison所有 如需转载请保留原文超链接地址!否则后果自负!