#import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; UIImageView *ivAvatar = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetWidth([self.view bounds]) / 2 - 50, 40, 100, 100)]; ivAvatar.image = [UIImage imageNamed:@"avatar.jpg"]; ivAvatar.layer.masksToBounds = YES; [ivAvatar.layer setCornerRadius:CGRectGetHeight([ivAvatar bounds]) / 2]; ivAvatar.layer.borderWidth = 5; ivAvatar.layer.borderColor = [[UIColor whiteColor] CGColor]; [self.view addSubview:ivAvatar]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } @end