After adding a constraint to imageview, the iOS9 is not valid in the cropped fillet as the avatar

Source: Internet
Author: User
<span id="Label3"></p><p><p>The usual method in the layoutsubviews, write these, can deal with the constraints of the fillet, but in iOS9 does not work, I use the 9.1 beta, the solution is subclass,uiimageview, and then look at the code behind</p></p><p><p>-(void) Layoutsubviews</p></p><p><p>{</p></p><p><p>[super layoutsubviews];</p></p><p><p>[self layoutifneeded];</p></p><p><p>_imageviewicon.layer.cornerradius = _imageviewicon.width/2;</p></p><p><p>_imageviewicon.layer.maskstobounds = YES;</p></p><p><p>_imageviewicon.clipstobounds = YES;</p></p><p><p>_imageviewicon.layer.opaque = NO;</p></p><p><p></p></p><p><p>[_imageviewicon setclipstobounds:yes];</p></p><p><p><span style="line-height: 1.5;">}</span></p></p><p><p><span style="line-height: 1.5;">Subclass:</span></p></p><p><p>-(instancetype) Init</p></p><p><p>{</p></p><p><p>If (self = [super init]) {</p></p><p><p></p></p><p><p>}</p></p><p><p></p></p><p><p>Return self;</p></p><p><p>}</p></p><p><p>-(void) Layoutsubviews</p></p><p><p>{</p></p><p><p>[super layoutsubviews];</p></p><p><p>[self layoutifneeded];</p></p><p><p></p></p><p><p>Self.layer.masksToBounds = YES;</p></p><p><p>Self.layer.cornerRadius = self.width*0.5;</p></p><p><p></p></p><p><p></p></p><p><p></p></p><p><p>}</p></p><p><p>After adding a constraint to imageview, the iOS9 is not valid in the cropped fillet as the avatar</p></p></span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.