martes, 4 de octubre de 2016

iOS: Round image view

Swift
     
        imageView.layer.cornerRadiusimageView.frame.height/2
        imageView.clipsToBounds = true

Objective C

self.imageView.layer.cornerRadius = self. imageView.frame.size.width/2;
self. imageView.layer.borderColor = [UIColor whiteColor].CGColor;
self. imageView.layer.borderWidth = 2;

self. imageView.layer.masksToBounds = YES;

Interface Builder



Note: 

1) If you are using constraints make sure that the constraint height is the same as the image view size in the interface builder
2) You can't set border color in IB


No hay comentarios:

Publicar un comentario