zoukankan      html  css  js  c++  java
  • 给ImageView添加约束后,在裁圆角作为头像,在ios9无效bug

    通常方法在layoutSubviews,写这些,可以对付约束情况下的圆角,可是在ios9不起作用了,我用的是9.1测试版,解决办法是subclass,UIImageView,然后看后面代码

    -(void)layoutSubviews

    {

        [super layoutSubviews];

        [self layoutIfNeeded];

            _imageViewIcon.layer.cornerRadius = _imageViewIcon.width/2;

            _imageViewIcon.layer.masksToBounds = YES;

           _imageViewIcon.clipsToBounds = YES;

    //    _imageViewIcon.layer.opaque = NO;

        [_imageViewIcon setClipsToBounds:YES];

    }

    subclass:

    -(instancetype)init

    {

        if (self = [super init]) {

        

        }

        return self;

    }

    -(void)layoutSubviews

    {

        [super layoutSubviews];

        [self layoutIfNeeded];

        

        self.layer.masksToBounds = YES;

        self.layer.cornerRadius = self.width*0.5;

    }

  • 相关阅读:
    CKeditor3.6.2 配置与精简
    CKEditor与CKFinder整合并实现文件上传功能
    实体关联关系映射:
    status pending状态
    wx:for
    小程序
    获取指定控件的值
    报表
    dataGridView 设置
    SQLite 的使用
  • 原文地址:https://www.cnblogs.com/daaiwusehng/p/4839337.html
Copyright © 2011-2022 走看看