Mac OS开发系列之NSImageView

作者: Bison | 来源:发表于2015-11-23 22:39 被阅读2967次

    最近研究下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;
    
    

    最终效果图如下

    NSimgView.png

    连载系列----请持续关注

    好文推荐:iOS开发内购全套图文教程

    推荐一款学习iOS开发的app_____|______| | 传送门

    技术交流群:534926022(免费) 511040024(0.8/人付费)


    版权归©Bison所有 如需转载请保留原文超链接地址!否则后果自负!

    相关文章

      网友评论

        本文标题:Mac OS开发系列之NSImageView

        本文链接:https://www.haomeiwen.com/subject/rxurhttx.html