Monday, 27 October 2014

Circular UIImageView with border and Programmatically UIImageView Creation in iphone sdk


UIImageView Circular: 

[imgView.layer setCornerRadius:22.0];
[imgView.layer setMasksToBounds:YES];

UIimageView Border:

imgView.layer.borderWidth = 2.0f;
imgView.layer.borderColor = [UIColor greenColor].CGColor;


Programmatically UIImageView Creation:


UIImageView *imgView = [[UIImageView alloc]initWithImage:img];
imgView.frame = CGRectMake(10, 10, 45, 45);
[self.view addSubview:imgView];
[imgView.layer setCornerRadius:22.0];
[imgView.layer setMasksToBounds:YES];
imgView.contentMode = UIViewContentModeCenter;
imgView.layer.borderWidth = 2.0f;
imgView.layer.borderColor = [UIColor greenColor].CGColor;


Example:




No comments:

Post a Comment