UIView *bfPanel = [[UIView alloc]initWithFrame:CGRectMake(x, y, width, height)]; bfPanel.layer.masksToBounds = YES; bfPanel.layer.borderWidth =1; bfPanel.layer.cornerRadius = 10; bfPanel.layer.borderColor= [[UIColor colorWithRed:0.52 green:0.09 blue:0.07 alpha:1] CGColor]; [mainView addSubview:bfPanel]; y +=height+10;