sábado, 10 de dezembro de 2011

Cantos Arredondados nas Imagens, Botões, e etc.


Adicionar o seguinte framework ao projeto:



// Declarar no header
#import <QuartzCore/QuartzCore.h>



// Código
- (void)viewDidLoad
{
    [super viewDidLoad];
    
    // Criando uma imagem
    CGRect rect         = CGRectMake((self.view.frame.size.width/2)-57, (self.view.frame.size.height/2)-90, 114, 175);
    UIImageView * image = [[UIImageView alloc] initWithFrame:rect];
    [image setImage:[UIImage imageNamed:@"bio.jpg"]];
    
    
    // Modificando os cantos
    image.layer.cornerRadius  = 20.0f;
    image.layer.masksToBounds = YES;
    
    
    // Adicionando a imagem na tela
    [self.view addSubview:image];
    
    [image release]; image = nil;
}

=================================================================================

Resultado: